Count the keys
EasyObjects3 min
Write a function count(obj) that returns the number of properties of the object obj.
Examples
count({ name: 'John', age: 30 })Returns 2
count({})Returns 0
count({ name: '', age: 0 })Returns 2
Loading the editor...
- Input
count({ name: 'John', age: 30 })Expected2 - Input
count({})Expected0 - Input
count({ name: '', age: 0 })Expected2
Hidden tests run on Submit