摘要:
Variables allow computers to store and manipulate data in a dynamic fashion. They do this by using a "label" to point to the data rather than using th 阅读全文
摘要:
正则表达式(Regular expressions或 regex)在编程语言中用于匹配字符串的部分。若想在'The dog chased the cat'中找到单词“the”,可以使用正则表达式:/the/。 注意,正则表达式中不需要引号。JavaScript有多种使用正则表达式的方法,检查正则表达 阅读全文
摘要:
Getter函数旨在简单地向用户返回(获取)对象私有变量的值,而无需用户直接访问私有变量。 Setter函数用于根据传递给Setter函数的值修改(设置)对象私有变量的值。此更改可能涉及计算,甚至完全覆盖以前的值。 class Book { constructor(author) { this._a 阅读全文
摘要:
在ES5中,我们通常定义构造函数,并使用new关键字实例化对象。 var SpaceShuttle = function(targetPlanet){ this.targetPlanet = targetPlanet; } var zeus = new SpaceShuttle('Jupiter') 阅读全文