Urgent.News

What's breaking now, across thousands of outlets.

Tech

Understanding Prototypes in JavaScript: A Practical Guide for Developers

JavaScript uses prototypes to support inheritance, property lookup, and shared behavior between objects. Although modern syntax gives us classes and familiar object-oriented patterns, prototypes remain the mechanism underneath many of those features. Understanding prototypes makes JavaScript behavior much easier to reason about. It helps explain why methods can be shared across instances, how…

JavaScript utilizes prototypes to facilitate inheritance, property lookup, and shared behavior among objects. Despite contemporary syntax offering classes and conventional object-oriented patterns, prototypes persist as the underlying mechanism for many of these features. Grasping prototypes aids in comprehending JavaScript's behavior, such as shared methods across instances, property lookup procedures, and the access to methods by objects generated from constructors without direct ownership.

The mechanics of JavaScript prototypes and prototype chains are elucidated: every JavaScript object possesses an internal prototype reference. When a property not directly present on an object is sought, JavaScript traverses the prototype chain until it either locates the property or reaches null. Constructor functions can define shared behavior through their prototype objects, enhancing efficiency by creating methods once for shared use by all instances rather than generating a unique function for each object.

Though modern JavaScript classes offer a more concise syntax for this model, class methods are similarly placed on the prototype. The prototype chain thus serves as a crucial foundation for understanding both traditional constructor functions and contemporary class-based JavaScript. The subsequent example illustrates direct properties, prototype methods, property lookup, constructor functions, the instanceof operator, and the prototype chain through step-by-step explanation.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

CVE-2026-92951: CVE-2026-92951: Sandbox Escape via External Package Allowlist Bypass in vm2

CVE-2026-92951: Sandbox Escape via External Package Allowlist Bypass in vm2 Vulnerability ID: CVE-2026-92951 CVSS Score: 9.9 Published: 2026-10-01 An incorrect authorization and directory traversal…

  • Remote attackers can bypass sandbox in vm2, execute arbitrary host code.
  • Incorrect authorization and directory traversal in external package allowlist.
  • Upgrade to vm2 version 3.11.7 or later to fix vulnerability.

"A second operation was started on this context" — the EF Core bug that only shows up under load

"A Second Operation Was Started on This Context" — The EF Core Bug That Only Shows Up Under Load You’ve debugged this error before: InvalidOperationException: A second operation was started on this…

  • Second operation started on EF Core bug under load conditions.
  • Root cause: service-lifetime design issue with fire-and-forget context leak.
  • Resolution: ensure one scope per unit of work, manage scopes explicitly.

Trying unknown Mac software without trusting it: a disposable macOS VM on Apple Silicon

At some point you want to try a Mac app you don't fully trust: a menu bar utility from a one-person shop, an installer someone linked in a forum, a CLI that wants sudo . Installing it on the machine that holds your SSH keys and browser profile is the fast option, and also the one with the worst cleanup story.

  • Disposable macOS VM on Apple Silicon tests unknown software safely.
  • VM provides separate macOS environment without affecting host system.
  • Requirements include Apple Silicon Mac, macOS 14, and compatible VM application.

More from Friday 2 October →