arrow functionwhich is introduced in this article. Arrow functions are useful, but not incredibly crucial so don’t worry about them too much just yet. We include them here because you are likely to encounter them as you move forward, and it’s better that you have at least some idea of what you’re looking at whenever they crop up.
Let’s write some functions! Write these in the
script tag of a skeleton html file. If you’ve forgotten how to set it up, review the instructions from fundamentals 1.
For now just write each function and test the output with
add7that takes one number and returns that number + 7.
multiplythat takes 2 numbers and returns their product.
capitalizethat takes a string and returns that string with only the first letter capitalized. Make sure that it can take strings that are lowercase, UPPERCASE or BoTh.
lastLetterthat takes a string and returns the very last letter of that string: