🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Tags, Releases and Versioning: all 15 questions

Quiz: Tags, Releases and Versioning · Question 7 of 15

What does this print? (code)

What does this print?

console.log(["v2.10.0", "v2.9.0"].sort()[0]);
  1. A.v2.9.0
  2. B.v2.10.0
  3. C.undefined
  4. D.v2
Answer & explanation

Correct answer: v2.10.0

Text sorting compares character by character: "1" comes before "9", so v2.10.0 sorts first, which is wrong for versions.

Can you get the rest right without peeking?

Take the timed Quiz: Tags, Releases and Versioning quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →