JavaScript Quiz Question #1: Array Sort Comparison
Nick Scialli (he/him)
Posted on April 21, 2020
Consider the following arrays. What gets logged in various sorting conditions?
const arr1 = ['a', 'b', 'c'];
const arr2 = ['b', 'c', 'a'];
console.log(
arr1.sort() === arr1,
arr2.sort() == arr2,
arr1.sort() === arr2.sort()
);
A) true true true
B) true true false
C) false false false
D) true false true
Put your answer in the comments!
💖 💪 🙅 🚩
Nick Scialli (he/him)
Posted on April 21, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.