ES2015の機能を使うとシンプルに書ける。
> let x = 2, y = 3;
undefined
> [x, y] = [y, x] # ここ
[ 3, 2 ]
> x
3
> y
2
Go to list of users who liked
More than 5 years have passed since last update.
ES2015の機能を使うとシンプルに書ける。
> let x = 2, y = 3;
undefined
> [x, y] = [y, x] # ここ
[ 3, 2 ]
> x
3
> y
2
Register as a new user and use Qiita more conveniently
Go to list of users who liked