Learn
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?
Instructions
1.
Copy the following line into app.js:
const h1 = <h1>Hello world</h1>;
Click Run when you’re finished.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.