const greetFunction = person.greet; greetFunction(); // "Hello, undefined" (this = global object)
It is designed to be accessible to intermediate developers while explaining the underlying mechanics that make JavaScript behave the way it does. understanding javascript the weird part parts
use Number() , String() , or explicit Boolean() . const greetFunction = person
Unlike most languages that use "Classical Inheritance" (Classes), JavaScript uses . const greetFunction = person.greet
var dog = new Dog("Fido"); dog.eat(); // Output: Fido is eating.