Defining Functions

You define a function by using the function keyword followed by a name that describes the use of the function, a list of zero or more arguments in (), and a block of one or more code statements in {}. For example, the following is a function definition that writes "Hello World" to the console:

function myFunction(){
  console.log("Hello World");
}

To execute the code in myFunction(), all you need to do is add the following line to the main JavaScript or inside another function:

myFunction();

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.49.252