javascript - Parse Uncaught TypeError: Cannot read property 'get' of undefined -
this code:
var images = new parse.query("images"); var bunny_data = []; images.equalto("indeximg","t"); images.find({ success: function(objects) { for(var = 0;i<=objects.length;i++){ var object = objects[i]; object.get('imgurl'); }; }, error: function(error) { console.log("an error occured :("); } }); console.log(bunny_data);
the console is:
[]
myjs.js:65 uncaught typeerror: cannot read property 'get' of undefined
for(var = 0;i<=objects.length;i++){
the <=
means loops 0
objects.length
inclusive, length exclusive upper bound on array’s indices. use <
instead.
Comments
Post a Comment