BigInt 3/3
Comparison with BigInt
We can use the comparison operators like greater than (<) or less than (>) with BigInt numbers just like we do with the numbers, for example.
12console.log(2n > 1n); console.log(5n < 2);
Swipe to start coding
You are given two BigInt in the following code you have to compare both of them by > and show the result on the console whether revenueOfBankA is greater than revenueOfBankB.
Løsning
Note:
Comparison operators will be covered in detail in the upcoming sections, but for now, just keep in mind that they are used to compare values or variables. We will work in detail with all kinds of the operator in the upcoming sections.
Summary
BigIntis a data type in JavaScript where we can have integers of arbitrary lengths.- We can use math operators with BigInt`just like numbers.
- We can use the comparison operators
<and>with theBigIntnumbers just like with the numbers.
Tak for dine kommentarer!
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Can you explain how BigInt comparisons work with regular numbers?
Are there any limitations when comparing BigInt with other data types?
Can you give more examples of using comparison operators with BigInt?
Fantastisk!
Completion rate forbedret til 2
BigInt 3/3
Stryg for at vise menuen
Comparison with BigInt
We can use the comparison operators like greater than (<) or less than (>) with BigInt numbers just like we do with the numbers, for example.
12console.log(2n > 1n); console.log(5n < 2);
Swipe to start coding
You are given two BigInt in the following code you have to compare both of them by > and show the result on the console whether revenueOfBankA is greater than revenueOfBankB.
Løsning
Note:
Comparison operators will be covered in detail in the upcoming sections, but for now, just keep in mind that they are used to compare values or variables. We will work in detail with all kinds of the operator in the upcoming sections.
Summary
BigIntis a data type in JavaScript where we can have integers of arbitrary lengths.- We can use math operators with BigInt`just like numbers.
- We can use the comparison operators
<and>with theBigIntnumbers just like with the numbers.
Tak for dine kommentarer!
single