Close

Not a member yet? Register now and get started.

lock and key

Sign in to your account.

Account Login

Forgot your password?

JS bulit-in for-in vs jQuery.each()

JS bulit-in for-in:
程式碼:

if (data.station) {
for (var key in data.station) {
alert('for-in: ' + data.station[key]['id'] + ': ' + data.station[key]['name']);
}
}

vs

jQuery.each():
程式碼:

?View Code JQUERY

if (data.station) {
$.each(data.station, function(idx, val) {
alert('$.each: ' + val.id + ': ' + val.name);
});
}

Leave a Reply

*