You have misspelled length
in the first loop.
Also consider using for-in
loop like:
for (property in obj) {
if (obj.hasOwnProperty(property)) {
//...
}
}
solved Nothing displaying in console when using console.log with if statements in for loops [closed]