OK, let's look next at object restructuring, so the structuring is pulling something apart, taking
a structure away, so a basic destruction looks like this will define as a constant.
And what we do is we define some variables inside curly braces, ID name age that match up to the object
properties.
And so we can do is pull the idea, the name and the age out of this object and store them in variables
so it pulls the object apart.
You can rename the the properties so I can say ID, we're going to call my ID and name, we're going
to call my name inside this OBJ and then you can also define some default values.
So if Object doesn't have the name, its name will be Sue.
And then you combine those and say, idee my equals one, two, three, that's the default name, my
name equals Mary and that's the default.
So let's look at some of the examples of these and these code.
All right, I'm going to start with this object definition that we had before, more or less of an employee.
So let's break this down into separate variables so I can say what name, age, job, salary
equals out.
And then we will those out console that log name, age, job, salary.
So so name is Bill, age of 33, Jarvis Carpenter salaries ten point five.
Now, there's no need to put them in the same order.
There's no need to get them all.
So I could just say job equals and so it just matches up the name.
So we'll just output only job.
And Carpenter, so it only matched what you needed to match in here so I could call this
profession.
And then I guess the name profession instead of job.
So the professionals carpenter and I could say, what say that there's another.
We think there might be another variable in here called experience, but I don't know if a employee
has experienced I'm going to say equals zero.
So profession
experience.
So Carpenters' zero now if this object didn't have experience
in 12, just 12.
And so that gets matched in, by the way, with objects you don't necessarily have to to put that into
the definition.
The original definition could be this, and you're perfectly free to say that experience equals 12 and
it's going to add it into the object.
So I could rename experience and say time on the job explaining to put that over here time my job equals
zero.
Same thing.
I am offering time on job down here now.
And there we go.
So that is an introduction to object restructuring, which breaks objects down into their individual
values.