Lets talk Javascript functions! Functions are very useful blocks of code that are reusable throughout your application. Javascript functions are only executed if they are called on. This is useful if you have a few lines of code that need to be used in multiple places in your application. This can save alot of time when writing code.
Here is an example of how to set up a function...
function reusable()
{
Here is where the code is that you will use in multiple places in your app
}
Javascript functions can also have arguments that will go in between the parenthesis. For example...
function reusuable(arg1, arg2)
{
Here is that reusable code
}
You can also request a value be returned and you would do that inside of the function.
function reusable(arg1, arg2)
{
Here is the reusable code
return value1
}
Happy Coding!
Top comments (1)
Your css is 👍 great