en.javascript.info/1-js/4-data-structures/4-object/5-count-properties/task.md
Ilya Kantor b043ea701d works
2016-07-03 18:27:36 +03:00

310 B

importance: 5


Count properties

Write a function count(obj) that returns the number of properties in the object:

let user = {
  name: 'John',
  age: 30
};

alert( count(user) ); // 2

Try to make the code as short as possible.

P.S. Ignore symbolic properties, count only "regular" ones.