Tuesday, 25 April 2017

NodeJS escaping back slash

I am facing some issues with escaping of back slash, below is the code snippet I have tried. Issues is how to assign a variable with escaped slash to another variable.

var s = 'domain\\username';
var options = {
    user : ''
};
options.wsdl_headers.user =  s;

console.log(s); // Output : domain\username - CORRECT
console.log(options); // Output : { user: 'domain\\username' } - WRONG

Why when I am printing options object both slashes are coming?

I had feeling that I am doing something really/badly wrong here, which may be basics.

please help me.



via Dipak

No comments:

Post a Comment