- Create a .js file called main.js. This will be separate from your .html and .css files. Save this in a folder titled scripts.
- Type the following code in your main.js file:
var myHeading = document.querySelector(‘h1’);
myHeading.textContent = ‘Hello world!’;
- Once everything is saved, you should be able to run those files in your browser and see something like this:
WestHost offers cheap web hosting for developers. Boost the websites you build with our shared, cloud and dedicated web hosting packages!