Answers for "how to insert data in array via for loop js"

1

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"));
Posted by: Guest on April-22-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language