函数返回字符串的后三位
function getStr() {
return str.slice(-3)
}
console.log(getStr`hello, world`) // 输出rld
NOTE: 你会发现,以上代码中在调用函数传递字符串的时候是用的不是传统的getStr('hello, world')
本文由 mdnice 多平台发布
函数返回字符串的后三位
function getStr() {
return str.slice(-3)
}
console.log(getStr`hello, world`) // 输出rld
NOTE: 你会发现,以上代码中在调用函数传递字符串的时候是用的不是传统的getStr('hello, world')
本文由 mdnice 多平台发布