728x90
반응형
// 예시 JSON 배열
var jsonData = [
{ "id": 1, "name": "John" },
{ "id": 2, "name": "Alice" },
{ "id": 3, "name": "Bob" },
{ "id": 4, "name": "Jane" }
];
// id가 2 이상인 요소들만 필터링
var filteredData = jsonData.filter(function(item) {
return item.id >= 2;
});
console.log(filteredData);
728x90
반응형
'Front > JS & jQuery' 카테고리의 다른 글
[js] indexOf() 문자열 (0) | 2024.04.20 |
---|---|
[jQuery][datatables] excel download 시 퍼센트 data가 소수로 출력되는 현상 (0) | 2024.04.19 |
[js] some() (0) | 2024.04.07 |
[js] json 배열 특정 값 포함여부 확인하기 / includes() 대신 (0) | 2024.04.06 |
[jquery][datatables] 페이지 이동 이벤트 처리 (0) | 2024.04.05 |