티스토리 뷰

🌈 JavaScript

List<object> 형식 흉내 내기

James Wetzel 2023. 8. 3. 14:25
728x90
반응형
// 빈 객체 배열 생성
const peopleArray = [];

// 객체 추가
peopleArray.push({ name: 'Alice', age: 30, occupation: 'Engineer' });
peopleArray.push({ name: 'Bob', age: 25, occupation: 'Designer' });
peopleArray.push({ name: 'Charlie', age: 40, occupation: 'Manager' });

console.log(peopleArray);

 

728x90
반응형