4 ms·
I don’t know much about JavaScript but the solution seems awfully complicated. Isn’t the an `escape_entities` function like in old school php (haven’t used php
by wodenokoto 5y ago
I don’t know much about JavaScript but the solution seems awfully complicated.
Isn’t the an `escape_entities` function like in old school php (haven’t used php in decades, so I don’t know how all the cool cats do it today)?
- jaffathecake 5y agoThere's https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe..., but it isn't quite a full solution. Also, URLSearchParams will set the content-type for you, and allows you to _decode_ urlencoded data.
- deleted 5y ago[deleted]
- cunthorpe 5y agoDid you just scroll through the article, saw many different examples and called it awfully complicated? Because the solution is just `new URLSearchParams({ text })` and that’s not complicated at all.