Skip to content

Latest commit

 

History

History
14 lines (13 loc) · 319 Bytes

add-to-the-end-of-array.md

File metadata and controls

14 lines (13 loc) · 319 Bytes

Given an array write a function that adds a given number to the end of the array without using the .push method.

CODE TEMPLATE


function addToEnd(arr,element){
// write your code here
}
let arr = [1,5,4,8,9];
let element = 7;
addToEnd(arr,element);
console.log(arr);