Command Shift

Data Types

Computers are useful. They are useful because they do stuff - more specifically, they do stuff with data.

At an abstract level, when you run any computer program, it will use data from some source (user input, data from the Internet, data written into the code etc) to tell you something useful about the data (a return value), or possibly to perform an action using that data (a side effect).

Basically, data goes in, data comes out.

In JavaScript this data comes in 5 main types:

  • Numbers
  • Strings
  • Booleans
  • Arrays
  • Objects

Numbers, strings and booleans are known as primitive data types.

Arrays and objects are known as data structures.

You should have a rough understanding by now of the type of data each of these represent.

There are a few other values to be aware of, including:

  • undefined - this is a sort of accidental no-value. It's like asking a question and being ignored. It's JavaScript's job to assign this - never assign it in your code.
  • null - this is typically an intentional lack of value - it's like asking a question and being told that there's nothing to report. Unlike undefined, we can assign this to variables.
  • NaN - not a number - the result of an invalid arithmetic statement, such as dividing a number by 0.

Each data type has its own built in functions that you can use to manipulate the data.

In this track, you are going to go through each of the data types and solve a series of problems around that type.

There are 57 problems in total, so good luck!

On this page

No Headings