Answers for "add element to the end of array without using push()"

0

add element to the end of array without using push()

var myArr = [['Ahmed', 300], 15, 'Third item']; // declare array.
myArr[myArr.length] = ['Omar', 350];
myArr[myArr.length] = ['Ali', 30];
console.log(myArr); // show: myArr = [['Ahmed', 300], 15, 'Third item', ['Omar', 350], ['Ali', 30]]
Posted by: Guest on March-20-2022

Code answers related to "add element to the end of array without using push()"

Code answers related to "Javascript"

Browse Popular Code Answers by Language