JS
…

Module 4 of 10

numbers

Round, parse, and use Math helpers used in real apps.

JavaScript Basics · 0/10 completed · scroll down for every challenge

Challenge 1 of 10

Parse integer

Instructions

Turn `"42px"` into an integer in `n` using `parseInt`.

Editor

IntelliSense on

// Write your code below

Challenge 2 of 10 · Parse float

Challenge 2 of 10

Parse float

Instructions

Turn `"3.14"` into a number in `pi` using `parseFloat`.

Editor

IntelliSense on

// Write your code below

Challenge 3 of 10 · Round

Challenge 3 of 10

Round

Instructions

Store `Math.round(4.6)` in `n`.

Editor

IntelliSense on

// Write your code below

Challenge 4 of 10 · Ceil

Challenge 4 of 10

Ceil

Instructions

Store `Math.ceil(2.1)` in `n`.

Editor

IntelliSense on

// Write your code below

Challenge 5 of 10 · Floor

Challenge 5 of 10

Floor

Instructions

Store `Math.floor(2.9)` in `n`.

Editor

IntelliSense on

// Write your code below

Challenge 6 of 10 · Absolute

Challenge 6 of 10

Absolute

Instructions

Store `Math.abs(-12)` in `n`.

Editor

IntelliSense on

// Write your code below

Challenge 7 of 10 · Max of list

Challenge 7 of 10

Max of list

Instructions

Store the largest of 3, 9, and 4 in `n` using `Math.max`.

Editor

IntelliSense on

// Write your code below

Challenge 8 of 10 · Min of list

Challenge 8 of 10

Min of list

Instructions

Store the smallest of 3, 9, and 4 in `n` using `Math.min`.

Editor

IntelliSense on

// Write your code below

Challenge 9 of 10 · Fixed decimals

Challenge 9 of 10

Fixed decimals

Instructions

Turn `price` 2.5 into the string `"2.50"` using `toFixed(2)` in `shown`.

Editor

IntelliSense on

const price = 2.5;
// Write your code below

Challenge 10 of 10 · Number.isNaN

Challenge 10 of 10

Number.isNaN

Instructions

Set `bad` to true if `Number.isNaN(Number.NaN)`.

Editor

IntelliSense on

// Write your code below

Next module