Exercise 9.2
Quoting Style
var text = "'I'm the cook,' he said, 'it's my job.'";
console.log(text.replace(/(^|\W)'|'(\W|$)/g, '$1"$2'));
To open the JavaScript console, press F12 or on MAC press COMMAND-OPTION-I.
var text = "'I'm the cook,' he said, 'it's my job.'";
console.log(text.replace(/(^|\W)'|'(\W|$)/g, '$1"$2'));
To open the JavaScript console, press F12 or on MAC press COMMAND-OPTION-I.