» » pitfalls

 
Sort articles by: Date | Most Rates | Most Views | Comments | Alphabet

8 common pitfalls in JavaScript

Author: bamboo06 on 1-04-2020, 19:02, views: 2028

1 javascript uses alphanumeric to sort by default. Therefore, the result of [1,2,5,10] .sort () is [1, 10, 2, 5]. If you want to sort correctly, you should do this: [1,2,5,10] .sort ((a, b) => a-b)
8 common pitfalls in JavaScript

javascript uses alphanumeric to sort by default. So the result of [1,2,5,10] .sort () is [1, 10, 2, 5].

Category: Javascript