For more information, please see full course syllabus of JavaScript

Start learning today, and be successful in your academic & professional career. Start Today!

Loading video...

This is a quick preview of the lesson. For full access, please Log In or Sign up.

For more information, please see full course syllabus of JavaScript

For more information, please see full course syllabus of JavaScript

### Functions

- There are two main types of Functions: JavaScript Library Functions and Programmer-Defined Functions
- JavaScript Library Functions are “built-in” functions, ready-to-use
- Programmer-Defined Functions need to be defined and called, in either order
- A“return” statement is required if a value is to be sent back to the function call

### Functions

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

- Intro 0:00
- Q & A 0:08
- Questions and Answers
- Two Main Types of Functions 1:11
- JavaScript Library Functions
- Programmer-Defined Functions
- Library Functions 1:55
- JavaScript Library Functions
- Examples
- Programmer-Defined Functions 3:01
- Procedure
- Programmer-Defined Functions 4:05
- Function Definition Syntax
- Example 1: Delayed Function 5:46
- Example 2: Squared Numbers 8:15
- Example 3: Exponents 12:08
- Example 4: One Die 16:13
- Example 5: Area of Circle 22:09
- Example 6: Area of Circle With Exponent 25:53
- Example 7: Temperature Converter 27:21

### Computer Science: JavaScript

I. JavaScript | ||
---|---|---|

Introduction to JavaScript | 22:43 | |

Working With JavaScript | 27:05 | |

If Logic | 35:39 | |

Operators | 57:26 | |

Loops | 23:42 | |

Functions | 31:55 | |

Events | 24:24 | |

Error Handling | 21:25 | |

Objects | 26:15 | |

Arrays | 18:19 |

0 answers

Post by Ebssa Tesema on July 1, 2015

Hei

Why do we need the function square (y)? how do we manage to exchange the values between x and y.

I see we have var x in the for loop where it is going to increment to 10; i also understand that we havn't given the square (x) function it is proper calculation instead we used function square (y);

and we are getting the result!!! ok but what does it mean to pass data?

can you please answer this question??

1 answer

Last reply by: Maury Hillstrom

Sun Feb 2, 2014 3:45 PM

Post by lae loe on January 28, 2014

Hello Maurry... I try this code and java script said missing radix parameter..

these are the two codes that show mssing radix parameter and the exponent didn't work..

original = parseInt(form.original.value);

exponent = parseInt(form.exponent.value);

function getExponent(){

var form = document.getElementById("exponentForm");

var original;

var exponent;

original = parseInt(form.original.value);

exponent = parseInt(form.exponent.value);

form.result.value = numP(original,exponent);

}

function numP(original, exponent)

{

var result = 1;

for(var i = 0; i <exponent; ++i);

result *= original;

return result;

}

1 answer

Last reply by: Maury Hillstrom

Sun Feb 2, 2014 3:43 PM

Post by lae loe on January 28, 2014

Hello Maurry... I try this code and java script said missing radix parameter..

these are the two codes that show mssing radix parameter and the exponent didn't work..

original = parseInt(form.original.value);

exponent = parseInt(form.exponent.value);

function getExponent(){

var form = document.getElementById("exponentForm");

var original;

var exponent;

original = parseInt(form.original.value);

exponent = parseInt(form.exponent.value);

form.result.value = numP(original,exponent);

}

function numP(original, exponent)

{

var result = 1;

for(var i = 0; i <exponent; ++i);

result *= original;

return result;

}

1 answer

Last reply by: Maury Hillstrom

Tue Nov 13, 2012 4:53 PM

Post by Clarence Eppinger on November 12, 2012

where and how does the value of "y" get set tto the current value of "x"?

0 answers

Post by Grady Ela on June 4, 2012

I am curious as to why the variable "x" is used at the top in the "for" statement but the variable "y" is used in the function. I noticed that they are interchangeable if you change all of the variables but I would like some clarification.

Thanks!

0 answers

Post by Jorge Guerrero on March 31, 2012

Very illustrative. I'm getting closer to deploying web applications the way I do in MS Access.

What I've noticed is that commercial languages such as VBA and VB are similar to echother, but open source langauges such as JavaScript and PHP are more similar to eachother.

Nevertheless, MS Access is a good start to manage desktop databases and from there mimic web applications for the same power.

Both are useful.