Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Number 2/3 | 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

Number 2/3

Rounding of Numbers

Rounding is one of the most frequent operations on the numbers. JavaScript provides several built-in functions for rounding which are given in the below table.

FunctionDescriptionExample
Math.floor()Rounds off to the lower limit3.1 becomes 3, and -1.1 becomes -2.
Math.ceil()Rounds off the number to the upper limit3.1 becomes 4, and -1.1 becomes -1.
Math.round()Rounds off the nearest integer when value is equal or greater than .53.1 becomes 3, 3.6 becomes 4, and 3.5 rounds up to 4 (the middle case)

Завдання

A variable named price with the assigned value of 4.7 has been given to you. Your task is to round off this variable such that we get 4 as the output.

Завдання

A variable named price with the assigned value of 4.7 has been given to you. Your task is to round off this variable such that we get 4 as the output.

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

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

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

Number 2/3

Rounding of Numbers

Rounding is one of the most frequent operations on the numbers. JavaScript provides several built-in functions for rounding which are given in the below table.

FunctionDescriptionExample
Math.floor()Rounds off to the lower limit3.1 becomes 3, and -1.1 becomes -2.
Math.ceil()Rounds off the number to the upper limit3.1 becomes 4, and -1.1 becomes -1.
Math.round()Rounds off the nearest integer when value is equal or greater than .53.1 becomes 3, 3.6 becomes 4, and 3.5 rounds up to 4 (the middle case)

Завдання

A variable named price with the assigned value of 4.7 has been given to you. Your task is to round off this variable such that we get 4 as the output.

Завдання

A variable named price with the assigned value of 4.7 has been given to you. Your task is to round off this variable such that we get 4 as the output.

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

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

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

Number 2/3

Rounding of Numbers

Rounding is one of the most frequent operations on the numbers. JavaScript provides several built-in functions for rounding which are given in the below table.

FunctionDescriptionExample
Math.floor()Rounds off to the lower limit3.1 becomes 3, and -1.1 becomes -2.
Math.ceil()Rounds off the number to the upper limit3.1 becomes 4, and -1.1 becomes -1.
Math.round()Rounds off the nearest integer when value is equal or greater than .53.1 becomes 3, 3.6 becomes 4, and 3.5 rounds up to 4 (the middle case)

Завдання

A variable named price with the assigned value of 4.7 has been given to you. Your task is to round off this variable such that we get 4 as the output.

Завдання

A variable named price with the assigned value of 4.7 has been given to you. Your task is to round off this variable such that we get 4 as the output.

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

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

Rounding of Numbers

Rounding is one of the most frequent operations on the numbers. JavaScript provides several built-in functions for rounding which are given in the below table.

FunctionDescriptionExample
Math.floor()Rounds off to the lower limit3.1 becomes 3, and -1.1 becomes -2.
Math.ceil()Rounds off the number to the upper limit3.1 becomes 4, and -1.1 becomes -1.
Math.round()Rounds off the nearest integer when value is equal or greater than .53.1 becomes 3, 3.6 becomes 4, and 3.5 rounds up to 4 (the middle case)

Завдання

A variable named price with the assigned value of 4.7 has been given to you. Your task is to round off this variable such that we get 4 as the output.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 3. Розділ 13
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt