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

Yep. We used to use this for some hacks back before AST libraries were a thing, mainly because Function.prototype.toString() preserves comments.

function foo() { /* a comment! / }

console.log(foo.toString()); //-> "function foo() { / a comment! */ }"



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: