Home Where Do I Belong Bonfire! My Solution - padma5/freecodecamp GitHub Wiki

Welcome to the freecodecamp wiki!

function where(arr, num) { // Find my place in this sorted array. arr.sort(function(a, b) { return a - b; });

function maxnumberinarray( array ){ return Math.max.apply( Math, array ); }; if(num>maxnumberinarray(arr)){ return arr.length; } var pos = 0; for(i=0;i<arr.length;i++) { if(arr[i]<num){ pos = i+1; } else { return pos; } } }

where([10, 20, 30, 40, 50], 35)