TemperatureJS: countObject

From The Travis van der Font Wiki
Jump to: navigation, search
function countObject(_object)
{
    return Object.keys(_object).length;
}
function countObject(_object)
{
    let length = 0;
    
    for (let key in _object)
    {
        if(_object.hasOwnProperty(key)
        {
            length++;
        }
    }
    
    return length;
}