Friday 29 April 2016

JavaScript Revision Notes - Functions

Here are some flashcards that will be helpful when starting out your JavaScript journey:

Functions


Here's how to create a simple function:


In our example, the parentheses are empty.


But we can also add arguments to our function.

We do this by defining the arguments inside the parentheses, and then adding them to the function when we call it:


We have defined the argument inside the parenthesis, giving it the name 'name', and we have passed in a string value of 'Danielle' when we call it. This will print out 'Hello Danielle'.

No comments:

Post a Comment