Help me please what wrong | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me please what wrong

Solve to forEach() need to find sum of salaries percent what need to pay for workers https://code.sololearn.com/W8DIREgEOA0z/?ref=app

6th May 2021, 6:41 PM
Olka Berkovich
Olka Berkovich - avatar
4 Answers
0
Hey
7th May 2021, 8:28 AM
Kumar Sharma
Kumar Sharma - avatar
+ 3
Something like this? Things that's looks erroneous: 1) You didn't call the main() function 2) readLine is not valid in vanilla JS 3) Your function salaryIncrease() didn't return the sum to the function call in main() function main() { var percent = parseInt(prompt(),10); console.log(salaryIncrease(percent)); } var salaries = [3000, 7000, 5000, 15000]; var sum = 0; var discount =0; const salaryIncrease = percent => { salaries.forEach(salary => { discount = salary * percent * 0.01; sum+= discount; }) //ваш код return sum; }; window.onload = () => main();
6th May 2021, 8:57 PM
Rohit
+ 1
you're welcome ☺️
8th May 2021, 8:31 PM
Rohit
0
Thank you a lot guys!
8th May 2021, 8:07 PM
Olka Berkovich
Olka Berkovich - avatar