Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
Built-in Constructors and their Prototype --

The activity was to Log Array.prototype and Object.prototype to the console using only the arr variable and the proto property.

So these are the original code:

const arr = [1, 2, 3];

console.log(); // log the Array.prototype
console.log(); // log the Object.prototype

So What I did: I wrote on the first, console.log(arr.__proto__ === Array.prototype); the second one is, console.log(arr.__proto__ === Object.prototype); but still not right. It says that in the first log, the Array.prototype is the proto property of any array. the next one, the prototype property of Array.prototype refers to the object.prototype. I can't figure it out what does it meant. I tried also writing like this: console.log(arr.__proto__ === Object.prototype); still not right. What am I missing here?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Here is a solution:

const arr = [1, 2, 3];
console.log(Array.prototype === arr.__proto__);
console.log(Object.prototype === arr.__proto__.__proto__);

Explanation: since array in Javascript is also an Object, you can access Object.prototype using just arr.

Following will also log true:

console.log(Array.prototype.__proto__ === Object.prototype);
console.log(Array.__proto__.__proto__ === Object.prototype);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!