I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
var largest =0;
//this line won't work for several reasons
//1. The highest number can be less than 0
//2. It is created outside the loop so it would save values
//from any array and save them pass the new iteration which you do not want
//3. You currently are not returning a value
The naming convention you are using is not correct for JavaScript so instead of new_arr you would have newArr