Re:Multiline strings in JavaScript
by mappum on Saturday July 12, 2014 @06:20AM
(#8024178)
That's a really smart hack, I didn't realize comments were included in the output of Function#toString. You could do other cool things, e.g. an annotation for type checking:
[ Parent
| on HN ]
Re:Multiline strings in JavaScript
by tlrobinson on Saturday July 12, 2014 @07:13AM
(#8024259)
I didn't realize comments were included in the output of Function#toString
Probably because sometimes they're not, depending on the JavaScript engine (though perhaps all of the major modern browsers do)
The following browsers return comments:
- Latest Chrome
- Firefox >=17
- Safari >=4
- Opera >=9
- Internet Explorer >=6
From: https://github.com/sindresorhus/multiline#compatibility
Not just "Latest Chrome". Chrome has been doing it for at least 2 years. I know, because I'm using it with it.
I think Chrome is mentioned as "Latest Chrome" because:
1) There have been so many versions and not easy to know what came when.
2) Most people get updated to Chrome latest automatically without any fuss.
In fact, (2) is not as true as it used to be. This graph, http://cdn.arstechnica.net/wp-content/uploads/2014/07/chrome..., shows that about 6-7 percent of worldwide browsers are out-of-date Chrome installs, and the trend is for that to grow.
From http://arstechnica.com/information-technology/2014/07/window...
That's correct. Chrome is practically versionless.