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:

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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -