Intro to JSX

Hello World

Take a look at the following line of code:

const 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 const 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?

Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.