+ 4
JS - replace with regex
I don't know why it's doing only for the first matched... How can I do to replace for all ? I did "gm" at the end of the regex but it's even not working... https://code.sololearn.com/W2OVYIss5ghQ/?ref=app
3 Respuestas
+ 4
It seems like you're attempting to do with regex replace what you could do with the third optional parameter of the JSON.stringify method...
Try:
JSON.stringify(a,null,'\t');
... and take a look at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Parameters ;)
+ 1
what is the intended output, as i'm getting this:
[ {"name":"NoxFly","age":18}, [{"name":"Max","age":17}, {"name":"Antoine","age":17}] ]