Js Understanding The Weird — Parts [portable]
Every object has a "prototype" property. If you try to access a property on an object and it’s not there, JS looks at the object's prototype. If it’s not there, it looks at that object's prototype. This continues until it hits the end of the chain ( null ). This is how methods like .toString() work on almost every object you create.
Most developers learn JS by trial and error. We see "weird" behaviors—like hoisting or this binding—and just find workarounds. js understanding the weird parts
JavaScript is often the first language people learn, yet it’s frequently the one they understand the least. We’ve all been there: you write a simple if statement or try to access a variable, and suddenly the console throws a curveball that defies logic. Every object has a "prototype" property
But JavaScript is weird. JavaScript has a secret weapon. This continues until it hits the end of the chain ( null )
console.log(5 + '5'); // outputs "55" console.log(5 - '5'); // outputs 0