9 Replies
variable
is assigned with an array containing 0
(zero) digitOk we can also specify using fill method also right?
Yes, but in this example using
.fill()
method seems like an overkillOk thanks for the info
What is the difference of declaring empty array over this 0?
I don't understand your question 😐
[]
is an empty array and [0]
is an array with zero insideOk so initialising with 0 and then pushing the new element will it over rite correct that 0 inside it
No, using
.push()
doesn't override anything in an array - it adds new value to the end of that array
So if you used .push(2)
to your variable
then you would have array looking like this [0, 2]
Oh ok thanks for understanding me this concept
This thread hasn’t had any activity in 12 hours, so it’s now locked.
Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1003992220032040960