I'm trying to replace a substring by another one using this code:
var body = 'Message: ' + req.query.message.replace('/(?:\r\n|\r|\n)/g', '<br/>');
But, proceeding that way I get this error message on that line:
TypeError: Cannot call method 'replace' of undefined
I wasn't able to find the solution to fix this using javascript. What I've found is related to only jQuery.
Any brilliant idea how to fix that, please?
It's saying req.query.message is undefined. You have to figure out why that is undefined.