Functions
What is a function?
Built-in functions
alertString.prototype.indexOfString.prototype.lengthArray.prototype.forEachArray.prototype.map
Anonymous functions
Parameters and return value
Function scope
Exercises
- Define a function with a parameter of name. Say hi to the name in the function.
- Define a function with a parameter of n. Caculate the sum of numbers from 1 to n, and return the sum.