I've come across this code many times and have never figured out what it means
/\n/g
This will replace all new line character in your string with "something" . i.e
var str="Hi\nHello";
console.log(str);
Output:
Hi
Hello
console.log(str.replace(/\n/g,"and"));
Output:
HiandHello
console.log(str.replace(/\n/g,""));
Output:
HiHello
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With