LearnFrenzy
Sign in Take a free test

Data Types · JavaScript Data Types MCQ · Question 10

Mixing BigInt and Number Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 10 Back to Exercise

What happens when you evaluate 5n + 1?

  • A It returns 6n
  • B It returns 6
  • C TypeError: Cannot mix BigInt and other types Correct
  • D It returns "5n1"
Correct Answer: Option C

Implicit conversion could lose precision, so arithmetic between BigInt and Number is forbidden. Write 5n + 1n or Number(5n) + 1. (Comparisons such as 5n > 1 are allowed.)

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links