Created
March 9, 2017 13:36
-
-
Save ahy4/70ae1a05b683af6c8a6514459c4bd216 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// bool*2-1 | |
let ary = [1,2,3]; | |
ary.sort((a, b) => (a>b)*2-1); // 小さい順 | |
console.log(ary); | |
ary.sort((a, b) => a-b); // 小さい順 | |
console.log(ary); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment