Question: Write a function that takes an array of numbers as a parameter and logs in the console the sum of all the numbers in the

Write a function that takes an array of numbers as a parameter and logs in the console the sum of all the numbers in the array. Test case 1: If you give this array, [5, 6, 99, 8, 76, 4, 68, 44], to the function, output should be: 310 because 5 + 6 + 99 + 8 + 76 + 4 + 68 + 44 Test case 2: If you give this array, [3, 0], to the function, output should be: 3 because 3 + 0

Write a function that takes an array of all numbers as a parameter, subtracts the total sum of all odd numbers of the array from the total sum of all even numbers and logs the result in the console. Test case: If you give these array, [5, 6, 99, 8, 76, 4, 68, 44], to the function, output should be: 102 Sum of odd numbers: 5 + 99 = 104 Sum of even numbers: 6 + 8 + 76 + 4 + 68 + 44 = 206 Difference between total even and total odd numbers: 206 - 104 = 10

Write a function that takes an array as a parameter and logs in the console the elements that have even indexes only. Notice: this question is not asking you to log elements with even value, but elements that are located on even indexes) Test case 1: If you give this array to the function [5, 6, 99, 8, 76, 4, 68, 44], toutput should be: 5 99 76 68 Test case 2: If you give this array to the function [11, Sam, 3, 7, car], output should be: 11 3 car

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!