Question from the Javascript test

Sort an array of strings in JavaScript

Hard

What will be the output of this code?

const array = ['Clément', 'Vincent', 'Baptiste', 'Valentin', 'Thomas', 'Quentin', 'Antonin'];
const sortedArray = array.sort((a, b) => a.localeCompare(b));
console.log(array);
console.log(sortedArray);
Author: Clément DevosStatus: PublishedQuestion passed 197 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!