TonykevinJS imagotipo

Learning Javascript

Variables

There are multiple options to define a variable, its choice depends on its scope . The limits of a variable are generally defined by curly brackets i.e. {}; otherwise, they are global. The following code consolidates the idea:

const star = 'sun'
function country () {
  var hills = true
  if (hills) {
    let animal = 'bear'
  }
}

Additionally, features such as: are hoisted (interprets the declaration at the top level of the scope and ignores the declaration point) or creates properties when the declaration is in the global scope, will determine which variables to use.

Strings

Numbers

Conditionals

Loops

Iterators

Functions

Collections

Object-oriented programming