Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

can't you just do

    _dontcare = {es5: syntax, /*with comments*/}
    data = JSON.stringify(_dontcare)

?


Yeah, you can do that in your .js source, but not in a separate, non-executed file. It is useful IMHO to separate static data from code. Also, this is useful for configuration files.


No, because syntax is undefined. Trailing comma and comment is removed when it is stringified.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: