728x90
반응형
객체가 컬렉션으로 사용되는 경우 콜백에 키-값 쌍이 매번 전달됩니다.
var obj = {
"flammable": "inflammable",
"duh": "no duh"
};
$.each( obj, function( key, value ) {
alert( key + ": " + value );
});
다시 말해서, 이는 두 가지 메시지를 생성합니다.
https://api.jquery.com/jQuery.each/
jQuery.each() | jQuery API Documentation
Description: A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1.
api.jquery.com
728x90
반응형
'Front > JS & jQuery' 카테고리의 다른 글
[js] Promise.allSettled() (0) | 2024.07.29 |
---|---|
[js] event.target / event.currentTarget (0) | 2024.07.28 |
[js] { ...data } 와 data 대입의 차이 (0) | 2024.07.11 |
[js] bind() (0) | 2024.07.10 |
[js][Echarts] pie chart 기본 색상 코드 (0) | 2024.07.02 |