Iterating a JavaScript object's properties using jQuery

后端 未结 4 613
温柔的废话
温柔的废话 2020-11-27 03:43

Is there a jQuery way to perform iteration over an object\'s members, such as in:

    for (var member in obj) {
        ...
    }

I just do

4条回答
  •  时光说笑
    2020-11-27 04:07

    $.each( { name: "John", lang: "JS" }, function(i, n){
        alert( "Name: " + i + ", Value: " + n );
    });
    

    each

提交回复
热议问题