Curriculum
Course: JavaScript Basic
Login

Curriculum

JavaScript Basic

JSHome

0/216
Text lesson

Loading JavaScript in HTML

Use simple syntax to load external scripts, as the type attribute is not required.

<script src=”myscript.js”></script>

Accessing HTML Elements

Using “untidy” HTML styles can lead to JavaScript errors.

These two JavaScript statements will produce different outcomes:

const obj = getElementById(“Demo”)

const obj = getElementById(“demo”)

File Extensions

HTML files should use the .html extension (though .htm is also allowed).

CSS files should have the .css extension.

JavaScript files should be saved with the .js extension.