January 2018
Intermediate to advanced
678 pages
20h 16m
English
A function in JavaScript is similar to a mathematical function. A mathematical function receives arguments, performs a calculation, and returns an answer. For example, the sin(x) mathematical function receives the x argument, calculates the sine of the given x angle, and returns the calculated sine of x. Likewise, a JavaScript function might receive arguments, will perform a calculation, and might return an answer. Here’s the syntax for calling a function:
function-name(zero-or-more-arguments-separated-by-commas);
As mentioned earlier, the Hello web page button has an onclick attribute with a value of displayHello();. That’s a JavaScript function call, and its syntax matches the preceding syntax. Note the parentheses are empty ...
Read now
Unlock full access