I have a program and that is a little bit insane.
This is the program and I wanted to know how many of you already know this concept.
var boy = {
name:"Natasha",
birthday : {
date : 1,
month : 'April',
}
}
var girl = { ...boy } ; // copying object
boy.name = 'Nitish' ;
boy.birthday.date = 31 ;
boy.birthday.month = "December" ;
console.log(boy) ;
console.log(girl);
These types of question are usually asked in the interview.
Comment you answer
For more question like this follow me
Top comments (0)