Tambahkan Slash ke String di JavaScript
str = str.replace(/'/g, "\\'");
Relieved Rhinoceros
str = str.replace(/'/g, "\\'");
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