Code Lab

Timer: 3 min, like in an interview. Hints and autocomplete are off while it runs

Sum of salaries

EasyObjects3 min

Write a function sumSalaries(salaries). In the object salaries each key is a name and each value is a salary.

Return the sum of all salaries. For an empty object return 0.

Examples

sumSalaries({ John: 100, Pete: 300, Mary: 250 })

Returns 650

sumSalaries({})

Returns 0

Source

Loading the editor...
  1. InputsumSalaries({ John: 100, Pete: 300, Mary: 250 })
    Expected650
  2. InputsumSalaries({})
    Expected0

Hidden tests run on Submit