⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1.03 - the mutability of objects.js

📁 JS设计模式源代码
💻 JS
字号:
function displayError(message) {  displayError.numTimesExecuted++;  alert(message);};displayError.numTimesExecuted = 0;/* Class Person. */function Person(name, age) {  this.name = name;  this.age = age;}Person.prototype = {  getName: function() {    return this.name;  },  getAge: function() {    return this.age;  }}/* Instantiate the class. */var alice = new Person('Alice', 93);var bill = new Person('Bill', 30);/* Modify the class. */Person.prototype.getGreeting = function() {  return 'Hi ' + this.getName() + '!';};/* Modify a specific instance. */alice.displayGreeting = function() {  alert(this.getGreeting());}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -