标签:lin oda template 扩展 布尔 变量 标签 color script
var str = "hello"; for(let i of str) { console.log(i); }
var s = ‘Hello world!‘; s.startsWith(‘Hello‘) // true s.endsWith(‘!‘) // true s.includes(‘o‘) // true
‘x‘.repeat(3) // "xxx"
‘x‘.padStart(5, ‘ab‘) // ‘ababx‘ ‘x‘.padStart(4, ‘ab‘) // ‘abax‘ ‘x‘.padEnd(5, ‘ab‘) // ‘xabab‘ ‘x‘.padEnd(4, ‘ab‘) // ‘xaba‘
// 普通字符串 `In JavaScript ‘\n‘ is a line-feed.` // 多行字符串 `In JavaScript this is not legal.` // 字符串中嵌入变量 var name = "Bob", time = "today"; `Hello ${name}, how are you ${time}?`
alert`123` // 等同于 alert(123)
标签:lin oda template 扩展 布尔 变量 标签 color script
原文地址:http://www.cnblogs.com/nankeyimeng/p/7273780.html