JavaScript has undergone several incarnations during its life. These transformations have made it possible to modify and fine-tune the object creation and manipulation process. Besides the usual way to create objects with constructor functions and to assign prototypes to those functions, you can directly create objects from a prototype, define properties with the desired descriptors, and also control the enumerability or configurability of the properties.
The functions that are used for this purpose are situated on the Object
constructor. For example, in order to create an object from an arbitrary prototype, you can use the Object.create
function. Here is a simple example:
const dog = {
bark() {
console.log("Woof-woof!");
},
};
let pluto = Object.create(dog);
pluto.bark();
This is a list of the functions used for object creation or manipulation that are accessible through Object
:
create
assign
defineProperty
defineProperties
getPrototypeOf
setPrototypeOf
getOwnPropertyDescriptor
getOwnPropertyDescriptors
getOwnPropertyNames
getOwnPropertySymbols
is
seal
freeze
preventExtensions
isExtensible
isSealed
isFrozen
keys
entries
values
There are a few methods on Object.prototype
that are related to these tasks:
hasOwnProperty
isPrototypeOf
propertyIsEnumerable
The following property and methods on Object.prototype
are deprecated and should not be used:
__proto__
__defineGetter__
__defineSetter__
__lookupGetter__
__lookupSetter__
Evidently, each of the functions that were listed in this post are very important and need extensive coverage. I hope to start a series of posts for explaining these functions.
Correct,
__proto__
is not a part of the specification. But still, we can usegetPrototypeOf
which does the same. So in your example:Object.getPrototypeOf(pluto) === dog
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Exactly. The new functions make those old mechanisms unnecessary, and I think they look ugly with all those underlines.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I think the major advantage of this "proto" property is the key role in javascript property delegation mechanism learning process, as we can quickly navigate prototype chain objects using it. Nothing more.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Multi talented people like you @ghasemkiani should be prominent according to their skills so that they can deliver maximum output towards community. All the best & Stay blessed!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you. I am just a curious person.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I love programming a lot.
javascript is the best programming language
I learn so manything from your post.
Thank you so much dear @ghasemkiani for share this topic with us.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
The Java program is a difficult language.i like this post.
thanks for sharing @ghasemkiani
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
hey dear @ghasemkiani relly excited java script. i hope you share next like tutorial.
And Thanks.
Well Done Bro.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I learned a lot about reading this post. But the Java script is very difficult. thanks for sharing @ghasemkiani
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I love programming too much. Javascript is a great programming language.
this post is very helpful for us.
Thank you so much for sharing your JavaScript coding expertise with us @ghasemkiani
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Great work done by you @ghasemkiani, you all the articles related to education which no doubt guide the student as well educate them.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Are you a programer too?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Yes, I mostly program in JavaScript and Java.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Wow!!!! What's your main job? How many job you do?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
As the old saying goes, I wear many hats!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Great. Keep it up sir.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Programming is my favourite also. web Programming, Javascript & CSS is also my favourite. PHP and Javascript coding is very interesting for me. thanks for this post sharing with us @ghasemkiani
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Dear I like It!This post is very Helpful for us. I am so glad for your post @ghasemkiani .Finally I wishing you regards for your regard.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Dear @ghasemkiani i think you run next seris i love pograming . & thanx for sharing.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
hey dear @ghasemkiani relly excited java script i hope you share next like tutorila. & thanx you so much for sharing .
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Great work done by you @ghasemkiani, you all the articles related to education which no doubt guide the student as well educate them. Keep it up , our support alongwith you.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
nice your post sir
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Always love. appreciate and like your post...
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Dear @ghasemkiani Thank you so much for your another content sharing:)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
i like your post dear.i waitting for your next post.
nice sharing @ghasemkiani
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Ow i know this....✌✌✌
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
i loved this post
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Amazing post really nice.....I like it.thx for share😍
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
useful coding
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
This post has received a 8.37 % upvote from @buildawhale thanks to: @ghasemkiani. Send at least 1 SBD to @buildawhale with a post link in the memo field for a portion of the next vote.
To support our daily curation initiative, please vote on my owner, @themarkymark, as a Steem Witness
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Great post.I am following you and upvote your post.please do same.
https://steemit.com/earth/@sornonil/new-jersey-is-now-home-to-the-largest-planetarium-in-the-western-hemisphere
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit