LoginSignup
0
2

More than 5 years have passed since last update.

JavaScript: [[1]] < [[2]]; // => true

Posted at

題名でだいたい終わっているんですが、1要素の配列はNumberにキャスト(?)することで第一要素を取り出せるようです。

// +をつけて数値にしてみる
> +[[1]]
1
// なので比較もできる
> [[1]] < 2
true
> [[1]] < 0
false

要素数が2つになるとNaNになるようです。

> +[[1, 2]]
NaN

Spec読めば仕組みは分かるんですが、時間がないので割愛。

使っちゃ負けな気がする

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2