Sorting array javascript not run

Hi! i need to sort array on javascript from the IDE but it doesn’t run :

const array = [3, 2, 1];
array.sort();
console.error(array);

Expected value :

[1, 2, 3]

Actual value :

[3, 2, 1] 

Thanks in advance :slight_smile:

should be
console.log(array) ? – depending on your js engine in use

Your code works. I’ve just tried it.

Try removing “const” from line array declaration

let array = [3,2,1];
array.sort();
console.error(array);