📌  相关文章
📜  在 javascript 代码示例中为字符串添加斜线

📅  最后修改于: 2022-03-11 15:03:23.108000             🧑  作者: Mango

代码示例1
var str = 'USDYEN'
// add a / in between currencies
// var newStr = str.slice(0, 3) + ' / ' + str.slice(3)

// var newStr = str.slice(3) // removes the first 3 chars
// var newStr = str.slice(0,3) // removes the last 3 chars
var newStr = str.slice(0,3) + ' / ' + str.slice(3) // removes the first 3 and adds the last 3

console.log(newStr)
// => USD / YEN