Lab - Javascript Functions
Let’s create some functions! Fork and clone the lab files , add your code to functions.js, and open index.html in the browser, then check the dev inspector to see your results!
1. A Bit Nervous
Sometimes we aren’t totally sure - let’s make a function to hedge our statements.
Create a function that adds “…I think” to strings, so that a string like “Functions are lists of instructions” becomes “Functions are lists of instructions…I think”
2. Today I learned
Other times we want to announce to the world what we learned! Let’s make another function.
Create a function that adds “Today I learned “ before string statements “Functions can take multiple inputs but only return a single output” becomes “Today I learned Functions can take multiple inputs but only return a single output”
3. Sales Tax Checkout
Remember the checkout function? Well, with the new 9.5% Seattle sales tax, we need to write a new checkout function so our cashier doesn’t have to calculate all that on their own. We also want to be able to use the value in other calculations, so don’t forget to return the value, not just print it out.
Add the 9.5% tax to the checkout function.