简体   繁体   中英

How to avoid escape characters added to a variable in Javascript?

Hello I have the following variable:

var delete_query = []

Then I assign

delete_query[0] = "CALL apoc.index.relationships('TO','statement:241') YIELD rel WITH DISTINCT rel DELETE rel;"

However, when I then print it out console.log(delete_query);

I see something like

[ 'CALL apoc.index.relationships(\\'TO\\',\\'statement:ae976060-1649-11e8-b256-ff710bab2aaf\\') YIELD rel WITH DISTINCT rel DELETE rel;']

How do I avoid escape character \\ being added?

Thanks!

No character has been added to the string. This is just the console adding it for display, so that it is unambiguous with respect to the quoting. It's essentially showing you the string as it would have to be written in source code, if it were written in source code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM