코딩앙마님의 강의를 듣고 정리한 내용입니다.
https://youtu.be/lekNM8ldxno
function showName(name){
console.log(arguments.length);
console.log(arguments[0]);
console.log(arguments[1]);
}
showName('Mike','soon');
//2
//'Mike'
//'soon'
function showName(...names){
console.log(names);
}
showName(); // []
showName('asdf') //['asdf']
showName('asdf','hjkl') //['asdf','hjkl']
function add(...numbers) {
let result = numbers.reduce((prev,cur)=>prev +cur);
console.log(result); //55
}
add(1,2,3,4,5,6,7,8,9,10);
function User(name,age,...skills){
this.name=name;
this.age=age;
this.skills = skills;
}
const user1 = new User("asdf",30,"html","css");
console.log(user1);
//{name:"asdf",age:30,skills:["html","css"]}
let arr1 = [1, 2, 3];
let arr2 = [4, 5, 6];
let result = [0, ...arr1, ...arr2, 7, 8, 9];
console.log(result); //[0,1,2,3,4,5,6,7,8,9]
let arr1 = [1, 2, 3];
let arr2 = [4, 5, 6];
arr1 = [...arr2, ...arr1];
console.log(arr1);
arr1 = [...arr2, ...arr1];
console.log(arr1);//[4, 5, 6, 1, 2, 3]
let user = { name: "Mike", age: 30 };
let user2 = { ...user };
user2.name = "soon";
console.log(user.name); //Mike
console.log(user2.name); //soon
let user = { name: "Mike" };
let info = { age: 30 };
let fe = ["JS", "React"];
let lang = ["Korean", "English"];
user = {
...user,
...info,
skills: [...fe, ...lang]
};
혹시 어느 회사 취업 성공하셨을까요?
포트폴리오 만드신 것 보는데 감탄을 금할 수 없었네요 !!