Una empresa tiene el registro de las horas que trabaja diariamente un empleado durante la semana (seis días) y requiere determinar el total de éstas, así como el sueldo que recibirá por las horas trabajadas.
function workHours(hours) { var total = 0 for (var i = 0; i < hours.length; i++) { total += hours[i] } return total } function salary(hours, value) { return workHours(hours) * value } console.log( salary([8, 7, 6, 5, 4, 3], 40) )