Quantcast
Channel: 連想配列タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 129

let {d,x,y,o}=data;

$
0
0

-連想配列の明示表現
-外部から来たオブジェクトが解らない時がある。コメントよりも明示的。

let {d,x,y,o}=data;
var obj={d:1,x:2,y:3,o:'eeeee'}

function a(data){
let {d,x,y,o}=data
console.log(data,'in a()')
}

a(obj)
console.log(obj)
/*
> Object { d: 1, x: 2, y: 3, o: "eeeee" } "in a()"
> Object { d: 1, x: 2, y: 3, o: "eeeee" }
*/

Viewing all articles
Browse latest Browse all 129

Trending Articles