Echo JS 0.11.0

<~>
jylauril 3497 days ago. link 3 points
A few pointers about this topic:

1) You should never EVER use eval for anything, unless you REALLY know what you're doing and there's no other way.

2) IF you really need to use eval, always wrap it in a try-catch statement to avoid your whole app breaking from a simple parse error.

3) The JSON library is nowadays inbuilt in all modern, and even older browsers. Starting from IE8, the browsers provide a native JSON implementation that you can safely use, so requiring the Crockford's JSON library is really not required, unless you need to support some really old browsers.

4) Even when you're using the JSON library for parsing JavaScript, you should always put it inside a try-catch statement, because there's a chance that it will throw a parse error in case of malformed data.

Replies