Code Editor
Learn

Take a look at the following line of code:

var h1 = <h1>Hello world</h1>;

What kind of weird hybrid code is that? Is it JavaScript? HTML? Or something else?

It seems like it must be JavaScript, since it starts with var = and ends with ;. If you tried to run that in an HTML file, it wouldn't work.

However, the code also contains <h1>Hello world</h1>, which looks exactly like HTML. That part wouldn't work if you tried to run it in a JavaScript file.

What's going on?

Report a Bug
If you see a bug or any other issue with this page, please report it here.