const obj = {
a:1,
b:2,
c: {cc:3}
}
//分割代入。オブジェクトのプロパティを指定してあげる
const {b, c} = obj;
console.log(b) // 2
console.log(c); // {cc:3}
console.log(d); //d is not defined
分割代入というES6での新しい書き方。
慣れないうちは違和感を覚えたので簡単にメモ。
More than 5 years have passed since last update.
const obj = {
a:1,
b:2,
c: {cc:3}
}
//分割代入。オブジェクトのプロパティを指定してあげる
const {b, c} = obj;
console.log(b) // 2
console.log(c); // {cc:3}
console.log(d); //d is not defined
分割代入というES6での新しい書き方。
慣れないうちは違和感を覚えたので簡単にメモ。
Register as a new user and use Qiita more conveniently