let contents = []
result = [
{
name:"하하",
age:31,
height:"180cm"
},
{
name:"호호",
age:31,
height:"160cm"
}
]
a = contents.push(result) // 배열 안에 배열 자체가 한 덩어리로 들어간다
console.log(a) // 1
console.log(contents)
/*
[
[
{ name: '하하', age: 31, height: '180cm' },
{ name: '호호', age: 31, height: '160cm' }
]
]
*/
let contents = []
result = [
{
name:"하하",
age:31,
height:"180cm"
},
{
name:"호호",
age:31,
height:"160cm"
}
]
a = contents.push(...result)
console.log(a) // 2
console.log(contents)
/*
[
{ name: '하하', age: 31, height: '180cm' },
{ name: '호호', age: 31, height: '160cm' }
]
*/