Question: Add a function called add ( a , b ) . Return the sum of a and b . Add a function called subtract (

Add a function called add(a, b). Return the sum of a and b.
Add a function called subtract(a, b). Return a-b.
Add a function called sum() with no parameters. Use the arguments and return a sum of all of the values passed to the function regardless of the number of arguments.
Add a function called setTitle() that outputs the "Hello, this is Lab 2!" to the h1 element with id="title".
Add a function called studentName(name) that outputs your full name to the div element with id="student".
Add a variable to the page called secondsSinceLoad and give it a starting value of 0. Add an arrow function (no curly brackets, no parenthesis, no function keyword) called updateSeconds(). In the function, add 1 to the value of secondsSinceLoad. Display the current value of secondsSinceLoad in the HTML div provided with id="seconds". The display must happen from in the function.
Call setTitle() when the page loads. I have provided a page load event below. Put all of the functions that should be called when the page loads into that single function.
Call and output the results from add(10,15); using document.writeln() at the end of the body element.
Call and output the results from subtract(45,10); using document.writeln() at the end of the body element.
Call and output the results from sum(5,10,20,30); using document.writeln() at the end of the body element.
When the page loads, use setInterval() to call updateSeconds() every 1 second.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!