Skip to content Skip to sidebar Skip to footer

I Want Toarray In JavaScript? Where Is It My Fault?

I add This code to my page and I want to complete city when user tap a zipcode and my alert dosen't show

Solution 1:

Firstly, there is no key named 97433 in your object

Secondly, even if there was you cannot use property accesors with object keys which begin with a number. You need to use bracket notation.

Lastly, use console.log() for debugging as alert() coerces types and blocks the UI logic.

var myVariable = obj['97433'];
console.log(myVariable);

Post a Comment for "I Want Toarray In JavaScript? Where Is It My Fault?"