We talked about variables before. A variable is a label associated to a value.

This value can has a type attached.

When it comes to types, you have 2 kind of programming languages: loosely typed and strongly typed.

And statically typed vs dynamically typed, but I won’t go into the explanation.

For now, just know that some languages really want you to deal with types, very explicitly, and some other languages let you be more dynamic. Typically, compiled languages are more strict on this matter.

JavaScript, Python, Ruby and other interpreted languages like to have loose types. Which means you can write

const number = 5

or

const name = 'Flavio'

without saying the first is a number, and the second is a string.

With JavaScript you’ll have several built-in types to work with: Object, Array, String, Number, Date, and more.

The type of a value identifies what you can do with it. It provides peculiar properties and methods you can call on it. For example a string can be trimmed using the trim() method. A number has other properties and methods.

In short, not all variables are equal.


Go to the next lesson