GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — JavaScript-Objects/Objects/07_prototype_property.js at js-object · last-endcode/JavaScript-Objects Expand file tree/ Copy path07_prototype_property.jsMore file actions 28 lines (24 loc) · 901 Bytes / Copy path07_prototype_property.jsFile metadata and controls28 lines (24 loc) · 901 Bytes 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. |