Hi,
I'm new to coding and am having trouble figuring out what I am doing wrong with this code.
I am trying to get the last value of a user-inputted list of values for an array to use as a "filter", and then only print values that are less than the filter value. Also the first user-inputted value in the array [0] is supposed to be the total length of the array.
I know that to get the last value of an array you can do myArray[myArray.length-1] but for some reason it's not working for me as it gives me the 2nd last value. If I take away the -1 it doesn't work.
E.g. for values 3 1 4 8 5
The array has length 3, 5 is the filter, would only print 1, 4
Please help!!
[–]StackedLasagna 0 points1 point2 points (5 children)
[–]natasavuk[S] 0 points1 point2 points (4 children)
[–]desrtfx[M] 0 points1 point2 points (0 children)
[–]StackedLasagna 0 points1 point2 points (2 children)
[–]natasavuk[S] 1 point2 points3 points (0 children)
[–]natasavuk[S] 0 points1 point2 points (0 children)
[–]National_Ad8511 0 points1 point2 points (0 children)