front-end-developer_1_
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Front-End-Developer - Level 1<br />
13.Practice writing functions<br />
In the Writing functions video, we learned:<br />
Arguments to functions can be assigned to variables called parameters<br />
The return keyword tells JavaScript to return the result from the line of code<br />
Don't abbreviate variable names because it can get confusing after time has passed<br />
Write some functions of your own:<br />
Take somebody's name and say a greeting to them;<br />
Write a function to subtract two numbers;<br />
Now one to multiply two numbers. Then create a new function called threeTimes to<br />
multiply three numbers together.<br />
Now write one to divide two numbers. Then write a new function called remainder to<br />
find the remainder of two numbers.<br />
Prompt the user to enter their age, another to enter their name and another to enter<br />
their favorite food. Then return an alert with a sentence that combines all of this<br />
information.<br />
Write a function that calculates BMI using two arguments. Then write another function<br />
that prompts the user for their height and weight, uses the BMI function and alerts the<br />
user of their BMI.<br />
Practice writing functions<br />
117