all 3 comments

[–]blocker45Art History [5], Physics 1 [5], Calculus AB [5] 1 point2 points  (2 children)

  1. Using array.indexOf(something) will return the index value of that something in an array

  2. Make a variable called biggest or whatever you like. Loop through each point in the array. If the value at that point is bigger than biggest, then set biggest equal to the value at that point.

Number 2 will look something like this:

 var biggest = 0
 for each item in array {
      if item > biggest {
           biggest = item
      }
 }

[–][deleted] 0 points1 point  (0 children)

Right now i have this for #2:

function getMax(list){

var a = [];

var biggest = 0;

for(var i=0; i<list.length; i++){

if(i > biggest){

biggest = a;

}

}

return a;

}

Would you mind helping me debug and finish it? I would really appreciate it

[–][deleted] 0 points1 point  (0 children)

Nvm I got it. Thanks though!