Question: a ) In lab 5 . js , write a function named sumEvery 5 th that accepts a nonnegative integer n and returns the sum
a In labjs write a function named sumEveryth that accepts a nonnegative integer n and returns the sum of the integers divisible by from to n including n itself. Use a for loop in your function to solve this problem.
b Run the two tests shown below in the console to verify your function works properly.
Tests
console.logsumEveryth; expect console.logsumEveryth; expect
c Create a labhtml file in your L folder that has a textarea element. Add code in your JavaScript file to call the sumEveryth function with an argument of and display the value it returns in the textarea of the web page. Hint: this was done in the pirate translation application.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
