Noticed something potentially strange using the JavaScript method sort(). Given the following array:
var arr = ['Aaa',
'CUSTREF',
'Copy a template',
'Copy of Statementsmm',
'Copy1 of Default Email Template',
'Copy11',
'Cust',
'Statements',
'zzzz'];
Calling sort by this array:
console.log(arr.sort());
Productivity:
["Aaa", "CUSTREF", "Copy a template", "Copy of Statementsmm", "Copy1 of Default Email Template", "Copy11", "Cust", "Statements", "zzzz"]
It is right? i.e. CUSTREFlisted first, is it because of its capital letters?
source
share