Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
7
Task/Natural-sorting/JavaScript/natural-sorting-1.js
Normal file
7
Task/Natural-sorting/JavaScript/natural-sorting-1.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
function naturalSort(a, b) => {
|
||||
return a.trim().localeCompare(b.trim(), 'und', { numeric: true })
|
||||
}
|
||||
|
||||
const files = ['file10.txt', '\nfile9.txt', 'File11.TXT', 'file12.txt']
|
||||
console.log(files.toSorted(naturalSort))
|
||||
// ['\nfile9.txt', 'file10.txt', 'File11.TXT', 'file12.txt']
|
||||
Loading…
Add table
Add a link
Reference in a new issue