We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

mc0re • 5 years ago

"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()

RunninglVlan • 5 years ago
Foxtrot • 3 years ago

thank you, this helped

Digonto Gomes • 1 year ago

I found that using https://youtube.com/playlis... and follow through this playlist will really give me a good understanding about Arrays.

vikas • 3 years ago

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

AmitGupta1 • 3 years ago
Anonymous • 4 years ago

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

Armando Roque Barahona • 4 years ago

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.