Thursday, 15 July 2021

Javascript object.length == undefined, need to use Object.keys(obj).length

 var a = {'test' : 1}

a.length 

// undefined

b = Object.keys(a);

["test"]

b.length

// 1

No comments:

Post a Comment