摘要:
传统上,JavaScript只有indexOf方法,来判断一个字符串是否包含在另一个字符串中。ES6又提供了三种新的方法。 includes();返回布尔值,表示是否找到了参数字符串; startsWith();返回布尔值,表示参数字符串是否出现在在源字符串的开头; endWith();返回布尔值, 阅读全文
posted @ 2017-02-11 12:17
孤舟远影
阅读(473)
评论(0)
推荐(0)
摘要:
const声明的是常量,一旦声明,值是不可变的; const PI = 3.1415; PI // 3.1415 PI = 3; PI // 3.1415 const PI = 3.1; PI // 3.1415 const也具有块作用域; if (true) { const max = 5; } document.write(max); // ReferenceErr... 阅读全文
posted @ 2017-02-11 11:24
孤舟远影
阅读(268)
评论(0)
推荐(0)

浙公网安备 33010602011771号