GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JavaScript-Objects/Objects/07_prototype_property.js at js-object · last-endcode/JavaScript-Objects

Expand file tree

/

07_prototype_property.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
28 lines (24 loc) · 901 Bytes
/

07_prototype_property.js

Copy path

File metadata and controls

28 lines (24 loc) · 901 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function Banking(value, initial_balance) {
this.value = value;
this.balance = initial_balance;
this.bank = 'mandiri';
}
// create Prototype
Banking.prototype.banks = 'Mandiri Syariah';
// Selalu perhatikan stiap membuat obj parameter const func
const john = new Banking(20, 200);
console.log(john); // Banking { value: 20, balance: 200, bank: 'mandiri' }
console.log(john.banks); // Mandiri Syariah
// create new prototype again
Banking.prototype.deposite = function (amount) {
this.balance *= amount;
console.log(
`Hello your value is ${this.value} with balance ${this.balance} on bank ${this.banks}`
);
};
// print deposite
john.deposite(4000);
/*output : Hello your value is 20 with balance 800000 on bank Mandiri Syariah */
const boby = new john.constructor(1000, 5000);
boby.deposite(150000);
// output: Hello your value is 1000 with balance 750000000 on bank Mandiri Syariah
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.