add data to an array using a for loop code example
Example: how to insert data in array via for loop js
function add(new_element){
let arr = [1,2,3,4,5];
for(let i=0;i<arr.length;i++)
{
arr.push(new_element);
}
return arr;
}
console.log(add("a"));