0

Append an element

How can I append an element to an array?

12th Jan 2019, 8:12 PM
Ric2908
Ric2908 - avatar
2 odpowiedzi
+ 1
append to an array is often refered as push operation. And you can push using Array.push(); method
12th Jan 2019, 8:22 PM
Adarsh.n. Bidari
Adarsh.n. Bidari - avatar
+ 3
var fruit = ["mango", "pear"]; fruit.push("apple"); console.log(fruit[2]); try it in your console, press f12, paste it and press enter.
12th Jan 2019, 8:34 PM
notqueued
notqueued - avatar