how to insert data in array via for loop js

Solutions on MaxInterview for how to insert data in array via for loop js by the best coders in the world

showing results for - "how to insert data in array via for loop js"
Nita
28 May 2020
1function add(new_element){
2	let arr = [1,2,3,4,5];
3	for(let i=0;i<arr.length;i++)
4	{
5		arr.push(new_element);
6	}
7
8	return arr;
9}
10
11console.log(add("a"));