JSON.parse without Strict Mode
-
29-04-2021 - |
Frage
I'm reading the John Resig blog about the Strict Mode in javascript, but i have a question.
One of the features of Strict Mode, is the use of JSON.parse and JSON.stringify, but i can use it WITHOUT "use strict".
If you write the same example that he's using on his blog:
var str = JSON.stringify({ name: "John" });
// Prints {"name":"John"}
alert( str );
You can see this working.
Why this is allowed? Am i missing something?
Thanks!
Lösung
There are a number of other new features and APIs that need attention, as well. The largest of which are Strict Mode and native JSON support.
You should read this as:
The largest of which are:
- "Strict mode"
- Native JSON support
Not as "JSON support, after enabling Strict mode".
See MDN: Strict mode for more information on this topic.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow