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

Course Content

Introduction to JavaScript (staging)

Introduction to JavaScript (staging)

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

BigInt 2/3

<code class="go3679463865">BigInt</code>with Math Operators

We can use most of the math operators with BigInt just like we do with numbers, for example.

1
console.log(11n + 22n);
copy

A BigInt number and a regular number cannot be used together for performing some arithmetic operations, for example.

1
console.log(100n + 200);
copy

For this, we have to convert the number into a BigInt number explicitly by calling the BigInt(), for example.

123
let bigint = 100n; let number = 200; console.log(bigint + BigInt(number));
copy

Task

A BigInt number named bigNumber with the assigned value of 12345n has been given to you. Your task is to:

  • Create a new variable named number and store 55 in it.
  • Convert the number to a BigInt number using the BigInt() function and store the result again in number.
  • Display the sum of these values.

Task

A BigInt number named bigNumber with the assigned value of 12345n has been given to you. Your task is to:

  • Create a new variable named number and store 55 in it.
  • Convert the number to a BigInt number using the BigInt() function and store the result again in number.
  • Display the sum of these values.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 3. Chapter 25
toggle bottom row

BigInt 2/3

<code class="go3679463865">BigInt</code>with Math Operators

We can use most of the math operators with BigInt just like we do with numbers, for example.

1
console.log(11n + 22n);
copy

A BigInt number and a regular number cannot be used together for performing some arithmetic operations, for example.

1
console.log(100n + 200);
copy

For this, we have to convert the number into a BigInt number explicitly by calling the BigInt(), for example.

123
let bigint = 100n; let number = 200; console.log(bigint + BigInt(number));
copy

Task

A BigInt number named bigNumber with the assigned value of 12345n has been given to you. Your task is to:

  • Create a new variable named number and store 55 in it.
  • Convert the number to a BigInt number using the BigInt() function and store the result again in number.
  • Display the sum of these values.

Task

A BigInt number named bigNumber with the assigned value of 12345n has been given to you. Your task is to:

  • Create a new variable named number and store 55 in it.
  • Convert the number to a BigInt number using the BigInt() function and store the result again in number.
  • Display the sum of these values.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 3. Chapter 25
toggle bottom row

BigInt 2/3

<code class="go3679463865">BigInt</code>with Math Operators

We can use most of the math operators with BigInt just like we do with numbers, for example.

1
console.log(11n + 22n);
copy

A BigInt number and a regular number cannot be used together for performing some arithmetic operations, for example.

1
console.log(100n + 200);
copy

For this, we have to convert the number into a BigInt number explicitly by calling the BigInt(), for example.

123
let bigint = 100n; let number = 200; console.log(bigint + BigInt(number));
copy

Task

A BigInt number named bigNumber with the assigned value of 12345n has been given to you. Your task is to:

  • Create a new variable named number and store 55 in it.
  • Convert the number to a BigInt number using the BigInt() function and store the result again in number.
  • Display the sum of these values.

Task

A BigInt number named bigNumber with the assigned value of 12345n has been given to you. Your task is to:

  • Create a new variable named number and store 55 in it.
  • Convert the number to a BigInt number using the BigInt() function and store the result again in number.
  • Display the sum of these values.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

<code class="go3679463865">BigInt</code>with Math Operators

We can use most of the math operators with BigInt just like we do with numbers, for example.

1
console.log(11n + 22n);
copy

A BigInt number and a regular number cannot be used together for performing some arithmetic operations, for example.

1
console.log(100n + 200);
copy

For this, we have to convert the number into a BigInt number explicitly by calling the BigInt(), for example.

123
let bigint = 100n; let number = 200; console.log(bigint + BigInt(number));
copy

Task

A BigInt number named bigNumber with the assigned value of 12345n has been given to you. Your task is to:

  • Create a new variable named number and store 55 in it.
  • Convert the number to a BigInt number using the BigInt() function and store the result again in number.
  • Display the sum of these values.

Switch to desktop for real-world practiceContinue from where you are using one of the options below
Section 3. Chapter 25
Switch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt