LoginSignup
0
1

More than 1 year has passed since last update.

JSの特殊な記述方法 書き殴り

Last updated at Posted at 2022-06-01

if文

let number = 10
let result = "";

if(number < 10) result = "10未満";
else if (number < 100) result = "100未満";

//一般的な記述
if(number < 10){
 result = "10未満"
}else if (number < 100){
 result = "100未満"
}

分割代入

const user = {
 id:1,
 name:"dossy"
}

let {id,name} = user

console.log(id)
//=>1

参考

https://www.youtube.com/watch?v=s3H6PmB4SZ4&t=153s&ab_channel=JamesQQuick
https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

こんな書き方Fantastic!!!

0
1
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
1