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
4 odpowiedzi
0
Hey
+ 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();
+ 1
you're welcome ☺️
0
Thank you a lot guys!