Contenido del Curso
Introduction to JavaScript (staging)
Introduction to JavaScript (staging)
BigInt 2/3
BigInt
with Math Operators
We can use most of the math operators with BigInt
just like we do with numbers, for example.
console.log(11n + 22n);
A BigInt number and a regular number cannot be used together for performing some arithmetic operations, for example.
console.log(100n + 200);
For this, we have to convert the number into a BigInt number explicitly by calling the BigInt()
, for example.
let bigint = 100n; let number = 200; console.log(bigint + BigInt(number));
Tarea
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 store55
in it. - Convert the
number
to a BigInt number using theBigInt()
function and store the result again innumber
. - Display the sum of these values.
¡Gracias por tus comentarios!
BigInt 2/3
BigInt
with Math Operators
We can use most of the math operators with BigInt
just like we do with numbers, for example.
console.log(11n + 22n);
A BigInt number and a regular number cannot be used together for performing some arithmetic operations, for example.
console.log(100n + 200);
For this, we have to convert the number into a BigInt number explicitly by calling the BigInt()
, for example.
let bigint = 100n; let number = 200; console.log(bigint + BigInt(number));
Tarea
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 store55
in it. - Convert the
number
to a BigInt number using theBigInt()
function and store the result again innumber
. - Display the sum of these values.
¡Gracias por tus comentarios!
BigInt 2/3
BigInt
with Math Operators
We can use most of the math operators with BigInt
just like we do with numbers, for example.
console.log(11n + 22n);
A BigInt number and a regular number cannot be used together for performing some arithmetic operations, for example.
console.log(100n + 200);
For this, we have to convert the number into a BigInt number explicitly by calling the BigInt()
, for example.
let bigint = 100n; let number = 200; console.log(bigint + BigInt(number));
Tarea
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 store55
in it. - Convert the
number
to a BigInt number using theBigInt()
function and store the result again innumber
. - Display the sum of these values.
¡Gracias por tus comentarios!
BigInt
with Math Operators
We can use most of the math operators with BigInt
just like we do with numbers, for example.
console.log(11n + 22n);
A BigInt number and a regular number cannot be used together for performing some arithmetic operations, for example.
console.log(100n + 200);
For this, we have to convert the number into a BigInt number explicitly by calling the BigInt()
, for example.
let bigint = 100n; let number = 200; console.log(bigint + BigInt(number));
Tarea
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 store55
in it. - Convert the
number
to a BigInt number using theBigInt()
function and store the result again innumber
. - Display the sum of these values.