+ 2

# JAVASCRIPT: 57.3 Practice - Salary Rise

In JavaScript Course, under ECMAScript 6 > 57.3 Practice. You need to write a program (using ES6 function/syntax) to calculate the total increase for each employee's salary in an array. using the percent as an input. Here's the given array: var salaries = [3000, 7000, 5000, 15000]; Let's say the input is 10 (percent), the 10 percent of each array is as follows: 300, 700, 500, 1500 Which in total, 3000. The program needs to output the TOTAL ONLY, I'm having a hard time to figure out how I can display the total only. I was able to display the percent increase for each employee. Please see my code below: function main() { var percent = parseInt(readLine(),10); console.log(salaryIncrease(percent)); } var salaries = [3000, 7000, 5000, 15000]; const salaryIncrease = percent => { //your code goes here salaries.forEach(v => { v = (v * percent) / 100; console.log(v); }); } Sample Input: 5 My Output: 150 350 250 750 undefined Expected Output: 1500 I know I'm not supposed to print each values, but I'm having a hard time on how I can display the sum/total of each value that I printed.

9th Oct 2021, 8:48 PM
Rolly U. Valdemoro Jr.