console.log(x)
x++
if(x == 3) return console.log('done')
nest(doll.push(new Array()))
}
nest([])
when I run it I get
0
1
nest(doll.push(new Array()))
^
TypeError: doll.push is not a function
When watching doll I notice it transforms from an array to 1 after the second or third run, why is this?
doll.push return integer, not array x = 0 function nest(doll){ console.log(doll) x++ if(x == 3) return console.log('done') nest([...doll, new Array()]) } nest([])
Обсуждают сегодня