ecmascript 6 - is there a syntax in javascript new features where i can extract object values into new object with same key and values? -
this question has answer here:
- one-liner take properties object in es 6 6 answers
let obj = { a: 1, b:2, c:3}
i can do
let {a,b,c} = obj
but want object 'a' , 'b' key , same value in obj
do have syntax one
it filtering out keys have succint syntax 1 because do
let test = { a: obj.a, b: obj.b }
how let n = ({a,b} = obj) && {a,b}
?
Comments
Post a Comment