Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Data Types Overview | Variables and Data Types
course content

Зміст курсу

Introduction to JavaScript

Data Types OverviewData Types Overview

Data can be represented in various ways, and the operations you perform on data can differ depending on the data types.

Note

The Data Type tells the interpreter how to work with the data.

Let's look at the difference in the interpreter behavior:

In the example above, you can see that the interpreter performs different operations for different data types.

typeof()

The typeof() operator returns a string indicating the type of the operand's value.

Number

The number data type is used for calculations, counters, mathematical operations, and more.

Unlike other programming languages, JavaScript uses the number type instead of separate int and float types.

Note

The typeof operator only determines the data type of the result, not the performed operations.

String

The string data type is used to change, print, and pass text to other programs.

To identify the string in the code, we should use single or double quotes (e.g., 'some text' or "some text")

Note

  • Choose one quote style ("text" or 'text') for your code or project;
  • You can switch between quote styles when using ' or " within the text, such as "She hasn't hat" or 'He says "Hi!"'.

Boolean

The boolean data type is used for logical operations. It has two values: true and false. Booleans are used to check conditions, as we'll describe later.

Booleans allow you to control code execution and direct it along different paths.

To create a boolean value, use the true or false values:

1. The `true` and `false` are ___.
2. What is the data type of the value `"number"`?
3. What is the data type of the value `15`?
4. What is the data type of the value `19.32`?
5. What is the data type of the value `true`?
6. Drag values to their types.

The true and false are ___.

Виберіть правильну відповідь

What is the data type of the value "number"?

Виберіть правильну відповідь

What is the data type of the value 15?

Виберіть правильну відповідь

What is the data type of the value 19.32?

Виберіть правильну відповідь

What is the data type of the value true?

Виберіть правильну відповідь

question-icon

Drag values to their types.

string:

number:


boolean:

Натисніть або перетягніть елементи та заповніть пропуски

Все було зрозуміло?

Секція 2. Розділ 4
course content

Зміст курсу

Introduction to JavaScript

Data Types OverviewData Types Overview

Data can be represented in various ways, and the operations you perform on data can differ depending on the data types.

Note

The Data Type tells the interpreter how to work with the data.

Let's look at the difference in the interpreter behavior:

In the example above, you can see that the interpreter performs different operations for different data types.

typeof()

The typeof() operator returns a string indicating the type of the operand's value.

Number

The number data type is used for calculations, counters, mathematical operations, and more.

Unlike other programming languages, JavaScript uses the number type instead of separate int and float types.

Note

The typeof operator only determines the data type of the result, not the performed operations.

String

The string data type is used to change, print, and pass text to other programs.

To identify the string in the code, we should use single or double quotes (e.g., 'some text' or "some text")

Note

  • Choose one quote style ("text" or 'text') for your code or project;
  • You can switch between quote styles when using ' or " within the text, such as "She hasn't hat" or 'He says "Hi!"'.

Boolean

The boolean data type is used for logical operations. It has two values: true and false. Booleans are used to check conditions, as we'll describe later.

Booleans allow you to control code execution and direct it along different paths.

To create a boolean value, use the true or false values:

1. The `true` and `false` are ___.
2. What is the data type of the value `"number"`?
3. What is the data type of the value `15`?
4. What is the data type of the value `19.32`?
5. What is the data type of the value `true`?
6. Drag values to their types.

The true and false are ___.

Виберіть правильну відповідь

What is the data type of the value "number"?

Виберіть правильну відповідь

What is the data type of the value 15?

Виберіть правильну відповідь

What is the data type of the value 19.32?

Виберіть правильну відповідь

What is the data type of the value true?

Виберіть правильну відповідь

question-icon

Drag values to their types.

string:

number:


boolean:

Натисніть або перетягніть елементи та заповніть пропуски

Все було зрозуміло?

Секція 2. Розділ 4
some-alt