skip to Main Content
The smarter way
to do assignments.

Please note that this is just a preview of a school assignment posted on our website by one of our clients. If you need assistance with this question too, please click on the Order button at the bottom of the page to get started.

Please make sure to submit the assessment with all of your code written below Question #9 in the Final Code Section. The code should be able to be copied and pasted into a program and then run without any changes being made to its format or syntax. //1. Declare a variable named “counter” and assign it an initial value of 10.
//2. Next, declare another new variable named “numbers” and assign it the initial value of an empty array.
//3. Now, declare a for loop and configure it so that it runs a total of ten times. Within the loop’s code block, increment the “counter” variable by 73, and push the new value of the “counter” variable into the “numbers” array.
//4. Below the code for your for loop, console log out the “numbers” array to the console.
//5. Next, create a conditional statement which checks if the value of the “counter” variable is greater than 740. If the value is greater than 740, console log the string “Maximum array number exceeded”, if the value is not greater than 740, console log the string “Array values within specification”.
//6. Now, declare a new variable named “stats”. Assign it the value of an empty object literal.
// Now that you have completed creating the arguments which will be passed into the function, it is time to create the function!
//7a. Declare a function named “getStats”.
//7b. Declare two parameters for the “getStats” function, “statsObj” (which will receive an object as an argument), and “numbersArr” (which will receive an array as an argument).
// Within the “getStats” function’s code block, create the following functionality:
//7c. Use a for loop to find the largest number in the “numberArr” parameter, and then assign that number to a new property on the “statsObj” parameter named “largestNum”. Do not use the “Math” object, or any JavaScript function to find the largest number.
//7d. Use a while loop to sum all of the numbers in the “numbersArr” parameter, and store that sum in a variable named “arrTotal”. Do not use the “Math” object, or any JavaScript function to sum the numbers in the array.
//7e. Divide the value you stored in “arrTotal” by the total number of elements in “numbersArr” to get the average of all numbers in the “numbersArr” and assign that value into a variable named “arrAverage”. Then, assign the value stored in the “arrAverage” variable to a property on the “statsObj” parameter named “averageNum”.
//7f. Lastly, return the “statsObj” parameter from the function.
// Outside of the “getStats” function, complete the final steps below:
//8. Call the “getStats” function and pass in the “stats” object and “numbers” array you created in steps 1 – 6 as arguments. Store the object which is returned from the “getStats” function into a variable named “returnedStats”.
//9. Finally, concatenate the values stored in the “returnedStats” object into appropriate places the following string “The largest number was ### and the average of all the numbers was ###” and console log the completed string to the console.


Clicking on this button will take you to our custom assignment page. Here you can fill out all the additional details for this particular paper (grading rubric, academic style, number of sources etc), after which your paper will get assigned to a course-specific writer. If you have any issues/concerns, please don’t hesitate to contact our live support team or email us right away.

How It Works        |        About Us       |       Contact Us

© 2018 | Intelli Essays Homework Service®