We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
Array.reverse()"the original array will not be affected" - this is not what the code shows. Type in:var arr = [true, 2, 3, "4"];new_array = arr.reverse()console.log(new_array); // ["4", 3, 2, true]console.log(arr); // ["4", 3, 2, true]
"arr" and "new_array" yield the same.
The same goes for Array.sort()
Nice catch. https://developer.mozilla.o...
thank you, this helped
Given an array like var arr = [(0,1,3),(-1,0,4),(-2,2,-5)];
How do I read each integer from this ?
Note: its small brackets inside square brackets
Write a script which allows user to add numbers of top 5 students in the class. after user has added numbers of 5 students show the data in console log. bonus... allow to add numbers only.. do not allow string or anything other than number
var odd_numbers = numbers.filter(item => item % 2);
i dont think its necessary to write var odd_numbers = numbers.filter(item => item % 2 == 1);
Very informative article great job.