+ 6
javascript
Fill in the blanks to copy the user object to the new user object by destructuring the name and age properties. Pass the value 9999 for the id property. const user = { name: 'David', age: 28, id: 1234 }; let newUser = Object.assign({}, {name, age} =____ , {id : 9999}); console.log(newUser);
15 Answers
+ 17
It's really simple.
If you want to copy info from user you have to pass that in blank.
For example :
const user = {
name: 'David',
age: 28,
id: 1234
};
let newUser = Object.assign({},
{name, age} = user,
{id : 9999});
console.log(newUser.name);
+ 2
Just to add onto this if you want more information, this is called "object destructuring".
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
+ 2
Answer is here..
const user = {
name: 'David',
age: 28,
id: 1234
};
let newUser = Object.assign({},
{name,
age
} =
user
,
{
id
: 9999});
console.log(newUser);
+ 2
Fill in the blanks to copy the user object to the newUser object by destructuring the name and age properties. Pass the value 9999 for the id property.
const user = {
name: 'David',
age: 28,
id: 1234
};
let newUser = Object.assign({},
{name,
age
} =
user
,
{
id
: 9999});
console.log(newUser);
+ 2
name
user
id
+ 1
const user = { name: 'David', age: 28, id: 1234};
let newUser = Object.assign({}, {name, age } = user , { id : 9999});
console.log(newUser);
> Object { name: "David", age: 28, id: 9999 }
+ 1
age
user
id
0
const user = {
name: 'David',
age: 28,
id: 1234
};
let newUser = Object.assign({},
{name,
age
} =
user
,
{
id
: 9999});
console.log(newUser);
0
Fill in the blanks to copy the user object to the new user object by destructuring the name and age properties. Pass the value 9999 for the id property.
Answer:-
It's really simple.
If you want to copy info from user you have to pass that in blank.
For example :
const user = {
name: 'David',
age: 28,
id: 1234
};
let newUser = Object.assign({},
{name, age} = user,
{id : 9999});
console.log(newUser.name);
0
its very easy
const user = {
name: 'David',
age: 28,
id: 1234
};
let newUser = Object.assign({},
{name,
age
} =
user
,
{
id
: 9999});
console.log(newUser);
0
add, sage, port
0
const user = {
name: 'David',
age: 28,
id: 1234
};
let newUser = Object.assign({},
{name,
age
} =
user
,
{
id
: 9999});
console.log(newUser);
0
const user = {
name: 'David',
age: 28,
id: 1234
};
let newUser = Object.assign({},
{name,
age
} =
user
,
{
id
: 9999});
console.log(newUser);
0
const user = { name: 'David', age: 28, id: 1234};
let newUser = Object.assign({}, {name, age } = user , { id : 9999});
console.log(newUser);
> Object { name: "David", age: 28, id: 9999 }
0
Fill in the blanks to copy the user object to the newUser object by destructuring the name and age properties. Pass the value 9999 for the id property.
const user = {
name: 'David',
age: 28,
id: 1234
};
let newUser = Object.assign({},
{name,
age
} =
user
,
{
id
: 9999});
console.log(newUser);