Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
JavaScript and Type Conversion | Data Types and Variables
Introduction to JavaScript (staging)
course content

Зміст курсу

Introduction to JavaScript (staging)

Introduction to JavaScript (staging)

1. Introduction
2. JavaScript syntax
3. Data Types and Variables

bookJavaScript and Type Conversion

JavaScript is a dynamic-type language:

We can assign any type of value to a variable. We can also change the type of a variable at any time and any position in the code. Let’s say we have assigned a string value to a variable, and then we want to change the type of that variable to a number.

123
let totalPrice = "thousand"; totalPrice = 1000; console.log(totalPrice);
copy

Завдання

A variable named totalDaysInMonth with the assigned string value of thirty has been given to you. Your task is to change the type of the variable from string to a number and display it on the console.

Summary:

  • The number datatype is for all kinds of numbers like integer or floating-point numbers.
  • The boolean variables can only have true or false as their values.
  • The typeof operator allows us to see the type of value stored in a variable.
  • JavaScript is a dynamic-type language, so we can change the type of data in it.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 3
toggle bottom row

bookJavaScript and Type Conversion

JavaScript is a dynamic-type language:

We can assign any type of value to a variable. We can also change the type of a variable at any time and any position in the code. Let’s say we have assigned a string value to a variable, and then we want to change the type of that variable to a number.

123
let totalPrice = "thousand"; totalPrice = 1000; console.log(totalPrice);
copy

Завдання

A variable named totalDaysInMonth with the assigned string value of thirty has been given to you. Your task is to change the type of the variable from string to a number and display it on the console.

Summary:

  • The number datatype is for all kinds of numbers like integer or floating-point numbers.
  • The boolean variables can only have true or false as their values.
  • The typeof operator allows us to see the type of value stored in a variable.
  • JavaScript is a dynamic-type language, so we can change the type of data in it.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 3
toggle bottom row

bookJavaScript and Type Conversion

JavaScript is a dynamic-type language:

We can assign any type of value to a variable. We can also change the type of a variable at any time and any position in the code. Let’s say we have assigned a string value to a variable, and then we want to change the type of that variable to a number.

123
let totalPrice = "thousand"; totalPrice = 1000; console.log(totalPrice);
copy

Завдання

A variable named totalDaysInMonth with the assigned string value of thirty has been given to you. Your task is to change the type of the variable from string to a number and display it on the console.

Summary:

  • The number datatype is for all kinds of numbers like integer or floating-point numbers.
  • The boolean variables can only have true or false as their values.
  • The typeof operator allows us to see the type of value stored in a variable.
  • JavaScript is a dynamic-type language, so we can change the type of data in it.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

JavaScript is a dynamic-type language:

We can assign any type of value to a variable. We can also change the type of a variable at any time and any position in the code. Let’s say we have assigned a string value to a variable, and then we want to change the type of that variable to a number.

123
let totalPrice = "thousand"; totalPrice = 1000; console.log(totalPrice);
copy

Завдання

A variable named totalDaysInMonth with the assigned string value of thirty has been given to you. Your task is to change the type of the variable from string to a number and display it on the console.

Summary:

  • The number datatype is for all kinds of numbers like integer or floating-point numbers.
  • The boolean variables can only have true or false as their values.
  • The typeof operator allows us to see the type of value stored in a variable.
  • JavaScript is a dynamic-type language, so we can change the type of data in it.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 3. Розділ 3
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
some-alt