Hi,
We gave a lot of though to how to handle this part of JavaScript. Here’s an excerpt from the whitepaper:
Despite the recent addition of classes to JavaScript by the ECMAScript 6 specification, the feature is not yet widely adopted. In fact, many popular frameworks require the continued use of the compensating idiom: the use of an outer function as a stand-in to create a kind of namespace or faux class. So as not to penalize JavaScript users, such outer functions are ignored when they are used purely as a declarative mechanism, that is when they contain only declarations at the top level.
However, the presence at the top level of a function (i.e. not nested inside a sub-function) of statements subject to structural increments indicates something other than a pure declarative usage. Consequently, such functions should receive a standard treatment.
So it’s the presence of your return <p>Hello world</p>;
that’s causing this to be treated not as a class but as a standard function.
HTH,
Ann