Skip to content

JavaScript Fundamentals

Adam Ponting edited this page Jan 7, 2021 · 7 revisions

2.1 Hello World

  • no need to use type="text/javascript"
  • /pathname is absolute
  • pathname is relative

2.2 Code Structure

  • semicolon ; at the end of each statement

2.3 The modern mode, "use strict"

  • "use strict" to enable newer features and allow old code to work still
  • "use strict" is best at the top of a .js page
  • not needed when using classes and modules

2.4 Variables

  • Cannot declare let or const without assigning a value at the same time
  • uppercase const for hard-coded, already known values, eg months, colours

Clone this wiki locally