anand
anand

Reputation: 1751

How to escape double quotes in Node.js

I have tried / to escape the double quotes in a string but i am not able to get the desired string.

The code snippets are as follows in Node.js

var queryString = "select * from courier where couriername LIKE '%"+filterName+"%'";
console.log(querystring);

The output i am getting is like with double quotes included on console:

select * from courier where couriername LIKE '%"a"%'

But I want output like this

 select * from courier where couriername LIKE '%a%';

How to get this .. I have tried many things ...

Upvotes: 0

Views: 2402

Answers (1)

Aston
Aston

Reputation: 225

Seems to me that filterName is equal to "a" and not a

Can you log its value ?

Upvotes: 1

Related Questions