Get property information of an object

 Get the number of an object's own properties:

var map = {'aaa': 'aaa'};
Object.getOwnPropertyNames(map).length;     // 1

 

Check if an object has a property:

var map = {'aaa': 'aaa'};
map.hasOwnProperty('aaa');    // true

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326526362&siteId=291194637