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

212
Views
How to display javascript prototype, conscructor, scope inside html element
  • I'm trying to create a simulator for console.log to use it in my phone to show deferant datatype result, code errors - the code is working fine and display, highlight all datatypes

enter image description here

  • but i want also to display constcrutor, scopes, prototypes like the web console is there's a way to loop throw them and get their data like this image

enter image description here

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

0

The constructor property can be gotten by referencing it explicitly, or by iterating over all properties of the object (not just enumerable properties), with Object.getOwnPropertyNames.

The [[Prototype]] property is equivalent to the value returned by Object.getPrototypeOf, so you can call that to access the prototype object and iterate through it too, if you want.

Perhaps something like:

const recursiveLogAllProperties = (obj) => {
  Object.getOwnPropertyNames(obj).forEach(prop => console.log(prop, obj[prop]));
  const proto = Object.getPrototypeOf(obj);
  if (proto === Object.prototype) return;
  console.log('------ Prototype:');
  recursiveLogAllProperties(proto);
}
const arr = [1, 2];
recursiveLogAllProperties(arr);

The [[Scopes]] internal property is not accessible from JavaScript.

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!