Q:

Prototypical inheritance in JavaScript

I am new to javascript's prototypical inheritance and js object-oriented programming. I was trying to create a base object, Account and then inherit the CheckingAccount from it. The following is my code.
function Account(fName, lName) {
   this.firstName = fName;
   this.lastName = lName;

 }

 Account.prototype.balance = function() {
    console.log("This is the balance");
 }

 function CheckingAccount() {

    this.salary = 10000;
 }

 CheckingAccount.prototype = Object.create(Account.prototype);

 let account = new Account("John", "Doe");
 let checking = new CheckingAccount();
 CheckingAccount.balance();

When I run it on Visual Studio, I am getting the following error: "Uncaught TypeError: CheckingAccount.balance is not a function"

A:

You want to call the method on the instance and not the Class object (e.g., checking not CheckingAccount).  Also, make sure to change the constructor. For further reading, refer to the MDN documentation.
You can see these changes here:

function Account(fName, lName) {
  this.firstName = fName;
  this.lastName = lName;
  this.salary = 0;
}

Account.prototype.balance = function() {
  return this.salary;    // you'll probably not use _only_ salary here
}

function CheckingAccount() {
  this.salary = 10000;
}

CheckingAccount.prototype = Object.create(Account.prototype);
// Make sure to update the constructor
Object.defineProperty(CheckingAccount.prototype, 'constructor', {
  value: CheckingAccount,
  enumerable: false, // so that it does not appear in 'for in' loop
  writable: true
});

let account  = new Account("John", "Doe");
let checking = new CheckingAccount();

console.log('account balance:',      account.balance())
console.log('checking balance:',     checking.balance())
console.log('account constructor:',  account.constructor);
console.log('checking constructor:', checking.constructor);

