profileRyan KesPGP keyI build stuffEmailGithubTwitterLast.fmMastodonMatrix

Binding / Variables in JavaScript

ES6

Let

let caught = 5 * 5
console.log(caught)

let mood = "light"
console.log(mood)
mood = "dark"
console.log(mood)

let luigisDebt = 140
luigisDebt = luigisDebt - 35
console.log(luigisDebt)

A single let statement my define multiple bindings

let one = 1,
  two = 2
console.log(one + two)

Const

This is a constant binding. It points to the same value for as long as it lives

const blaat = "abcd"
console.log(blaat)
/**
 * Following will both cause errors:
 *
 * blaat = "efgh"
 * let blaat = "efgh"
 */