배열2 JavaScript 객체의 확장, 직렬화, 메서드 📌 객체 확장객체를 확장하는 방법은 새로운 프로퍼티를 추가하거나 기존 프로퍼티를 수정한다. 이를 위해 Object.assign 메서드를 사용할 수 있습니다.const person = { name: 'Kim', age: 30};const additionalInfo = { job: 'Developer', city: 'Seoul'};const updatedPerson = Object.assign(person, additionalInfo);console.log(updatedPerson);// Output: { name: 'Kim', age: 30, job: 'Developer', city: 'Seoul' } ES6부터는 스프레드 연산자('...')를 사용하여 객체를 확장할 수 있다.const updat.. 2024. 1. 29. 배열과 객체의 유사점과 차이점 1. 배열과 객체 생성 > 동일한 출력값을 보여준다. //배열 생성 const toolArray = ['html', 'css', 'js']; //1. 출력 console.log(toolArray[0]); // 출력값 : html console.log(toolArray[1]); // 출력값 : css console.log(toolArray[2]); // 출력값 : js //객체 생성 const tollObj = { '0' : 'html', '1' : 'css', '2' : 'js' } console.log(tollObj[0]); // 출력값 : html console.log(tollObj[1]); // 출력값 : css console.log(tollObj[2]); // 출력값 : js 2. typeof 연.. 2023. 7. 11. 이전 1 다음