3 ms·
But that only applies to the parsing step. With JSON.parse you will parse it every time the code executes, so if that code is in function, JavaScript probably w
by vbezhenar 7y ago
But that only applies to the parsing step. With JSON.parse you will parse it every time the code executes, so if that code is in function, JavaScript probably will be better, because compiler can't just optimize out JSON.parse (because someone might redefine window.JSON object or redefine its parse property).
- hedora 7y agoThat’s why you should put all your json literals at the topmost scope in the file. After all, global variables are the best variables. (Per the article’s advice, unless I’m missing something)