for example, get a variable a
, and this variable a
may be an object returned by the server.
a: {
name: "xiaobe",
age: 22,
title: "xxx"
}
I want to assign name
and age
of a
to b
(actually want to take out more attributes)
is there any quick and easy way? Now I think of deconstructing it like this:
const { name, age } = a;
b = { name, age }