Functions

Functions

Complete the following steps

Using function declaration, define a function named add that takes two arguments, number1 and number2
In the function, return the sum of the parameters number1 and number2
Using function declaration, define another function named addNumbers that gets the values of two HTML form controls with IDs of addend1 and addend2. Pass them to the sum function
Assign the return value to an HTML form element with an ID of sum
Add a “click” event listener to the HTML button with an ID of addNumbers that calls the addNumbers function
Using function expressions, repeat Steps 1-5 with new functions named subtract and subtractNumbers and HTML form controls with IDs of minuend, subtrahend, difference and subtractNumbers
Using arrow functions, repeat Steps 1-5 with new functions named multiply and multiplyNumbers and HTML form controls with IDs of factor1, factor2, product and multiplyNumbers
Using any of the three function declaration types, repeat Steps 1-5 with new functions named divide and divideNumbers and HTML form controls with IDs of dividend, divisor, quotient and divideNumbers
Test all of the mathematical functionality of the task3.html page.
Built-In Methods

Complete the following steps

Declare and instantiate a variable of type Date to hold the current date
Declare a variable to hold the current year
Using the variable declared in Step 1, call the built-in getFullYear() method/function and assign it to the variable declared in Step 2
Assign the current year variable to an HTML form element with an ID of year
Array Methods

Complete the following steps

Declare and instantiate an array variable to hold the numbers 1 through 25
Assign the value of the array variable to the HTML element with an ID of array
Use the filter() array method to find all of the odd numbers of the array variable and assign the reult to the HTML element with an ID of odds ( hint: % (modulus operartor) )
Use the filter() array method to find all of the even numbers of the array variable and assign the result to the HTML element with an ID of evens
Use the reduce() array method to sum the array variable elements and assign the result to the HTML element with an ID of sumOfArray
Use the map() array method to multiple each element in the array variable by 2 and assign the result to the HTML element with an ID of multiplied
Use the map() and reduce() array methods to sum the array elements after multiplying each element by two. Assign the result to the HTML element with an ID of sumOfMultiplied

Complete Answer:

Get Instant Help in Homework Asap
Get Instant Help in Homework Asap
Calculate your paper price
Pages (550 words)
Approximate price: -
Open chat
1
Hello 👋
Thank you for choosing our assignment help service!
How can I help you?