How to get .ForEach() to return first element of an array
I am trying to complete the Salary increase challenge for Javascript using .forEach() method. I am struggling to output the correct element for each of the tests. The expected input and answers are: 5, 1500 10,3000 50, 15000 My Code so far is passing the 3rd test only: 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 => { var increase = v*(percent/10); percent = v; }) return percent } I am unsure how to get it to return the right result for each different percent that is inputted into the function. I know the formula is right, as when I console.log(increase) it gives me the following answers: 1500, 3500, 2500, 7500. 3000, 7000, 5000, 15000 15000, 35000, 25000, 75000 How can I assign percent to be the first element of increase?