Technical Knowledge Assessment .

Declare a variable named “counter” and assign it an initial value of 10.

Next, declare another new variable named “numbers” and assign it the initial value of an empty array.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.Below the code for your for loop, console log out the “numbers” array to the console.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”.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:

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”.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.

Sample Solution
The post Technical Knowledge Assessment .

Image result for Order Now images

CLICK HERE TO ORDER NOW!!

Leave a Reply

Your email address will not be published. Required fields are marked *