Make an RPG
Examples of Functions and Parameters
Here is the new syntax:
The first part says "Here is a variable"
The second part says "It's a function and here it is".
You can define defaults for any of your parameters, simply like so:
You call the function in the same way as before.
Or use the default parameters, like so:
If you're worried about browser support, go checkout Compat table ES6. It's pretty thorough. You can see that modern browsers pretty much fully support ES6 since 2017.
If you want some more examples and explanations, I would recommend you check out w3schools ES6 as they have some great explanations.
In the next lesson, we will learn about Examples of how to use Maps and Sets
Get the Latest Tutorial Updates