Reputation: 21440
Writing a regular expression, I found this code:
JSON.stringify(e.model.ProcedureDate).replace(/\"/g, '');
Why does /\"/g
work without being quoted? It isn't a string, and from what I gather, javascript doesn't have literals... What would you call the text passed to .replace()
?
Upvotes: 0
Views: 26
Reputation: 22340
It is a regular expression literal, equivalent to:
new RegExp('\\"', 'g')
in the same way as []
is equivalent to new Array(0)
.
Upvotes: 2
Reputation: 32521
Javascript has regular expression literals. That's an example of one.
Upvotes: 2