[JS] $.each(), Array.forEach(), Array.some()
$.each() //방법 //선언된 Array의 개수만큼 반복 실행 $.each(Array, callback function(index, value) { //반복되는 내용 } //예제 const arr = ["item1", "item2", "item3"]; $.each(arr, function(index, value) { console.log("index= " + index + ", value= " + value); //return true; ➡ for문의 continue 역할 //return false; ➡ for문의 break 역할 } Array.forEach() //방법 Array.forEach(callback function(value, index, array) { //반복 내용 }); //예제 ..
2022. 4. 25.