Home > Article > Web Front-end > Introduction to the use of [] and {} objects in javascript_javascript skills
Of course, there is an each traversal in jquery, and you can also access various properties and values. But this is only the case if
var c={};, if it is
< ;/PRE> <br><PRE class=html name="code"><PRE class=html name="code">var c=[];
Then use
$.each(c, function(key, val) { <br>alert(key ":" val); <br>});
It is very convenient to use objects. It is much faster than using arrays. The time complexity of finding a certain value in the array is O(n) , and the time complexity of using objects is only O(1), so in most cases objects are used to store values.
< /PRE> <br><PRE>