Tech Junkie Blog - Real World Tutorials, Happy Coding!: JavaScript Objects Deep Dive : Create Objects With Object.Create

Monday, November 1, 2021

JavaScript Objects Deep Dive : Create Objects With Object.Create

Object.Create( ) is a static function which can take two arguments.  The first argument is the prototype of the object, while the second argument is the properties of the argument.  A prototype is a second object that is created with every JavaScript object.  It is like a blueprint, or the model that the object is built on.  Think of it as a car prototype.

So let's create an object with Object.Create( ) function:

var person = Object.create({
    name: "Tech Junkie",
    location: "Mars",
    hobbie: "Video Games"
});

console.log(person);


Here is how the object looks like:
















Notice how it's different than creating an object with new keyword.  In this case you are actually using the object's prototype object.

Here is how the object would look with the new keyword

var person = new Object({
    name: "Tech Junkie",
    location: "Mars",
    hobbie: "Video Games"
});

console.log(person);













2 comments:

  1. Replies





    1. error404-store




      - -- Spamming tools --




      1-- cpanel https ssl secure
      2-- shell ssl secure
      3-- web-mail
      4-- smtp
      5-- rdp with send bluster
      6-- scam pages
      7-- ceo or cfo leads




      -- Spy virus slinet Exploits --




      1-- privet rat
      2-- crypter exploits
      3-- privet rdp hosting
      4-- os andriod spy virus
      5-- iso iPhone spy virus
      6-- Nokia spy virus




      - -- scanners brute-force ---




      1-- linux roots
      2-- cpanel scanner
      3-- cpanel bruter
      4-- shell scanner
      5-- smtp scanner
      6-- smtp bruter
      7-- zimbra scanners


      - -------------------


      cpanel,shell,smtp,scampages,sender,ceo or cfo leads,rdp,spyvirus,crypter,exploits,scanners


      Telegram:- @Donsmith000


      icq :- @Donsmith000


      https://error404-store.blogspot.com



      Delete

Search This Blog