An example of the difference between $. Each and $of. Each
- 2020-03-30 02:24:58
- OfStack
The difference between $.each() and $().each,$.each is a generic iteration function that can be used to approximately iterate over objects and arrays, and $().each is dedicated to iterating and executing jquery object functions. While this function can be used to iterate over any object, the callback of this function contains two parameters: the first is the key (object) or index (array), and the second is the value.
<script type="text/javasctip">
var json = {
<span style="white-space:pre"> </span>[
<span style="white-space:pre"> </span>'name':'tom',
<span style="white-space:pre"> </span>'school': 'middle school',
<span style="white-space:pre"> </span>'grade': 95
<span style="white-space:pre"> </span>]
<span style="white-space:pre"> </span>
}
</script>