Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce JS-Dev-101 Exam - Topic 1 Question 2 Discussion

Actual exam question for Salesforce's JS-Dev-101 exam
Question #: 2
Topic #: 1
[All JS-Dev-101 Questions]

Refer to the code:

const pi = 3.1415926;

What is the data type of pi?

Show Suggested Answer Hide Answer
Suggested Answer: D

________________________________________

Comprehensive and Detailed Explanation From Exact Extract JavaScript Knowledge

JavaScript has one numeric data type for all real numbers, whether integers or decimals.

This type is simply called:

Number

It follows the IEEE 754 double-precision floating-point standard internally,

but JavaScript does not expose separate types like float, double, or decimal.

Therefore:

It is not Float JavaScript does not have float primitives.

It is not Double this refers to the underlying IEEE 754 representation, but JavaScript's type is still just ''Number.''

It is not Decimal JavaScript has no built-in decimal type.

The correct answer is Number.

________________________________________

JavaScript Knowledge Reference (text-only)

JavaScript has a single numeric type: Number.

All numbers---integers, fractions, floating point---use the Number type.

==================================================


Contribute your Thoughts:

0/2000 characters
Jess
5 days ago
I thought it would be Double, but I guess not!
upvoted 0 times
...
Karina
10 days ago
Definitely a Float, right?
upvoted 0 times
...
Berry
15 days ago
It's a Number type in JavaScript!
upvoted 0 times
...
Alex
20 days ago
I thought Decimal was used for financial calculations, so it can't be pi. I’m leaning towards Double, but I need to double-check.
upvoted 0 times
...
Sean
25 days ago
I’m confused between Float and Double. I feel like I saw something about precision differences in a practice question.
upvoted 0 times
...
Aileen
1 month ago
I remember practicing a question about data types, and I think "Number" might be the right answer since JavaScript uses it for all numeric values.
upvoted 0 times
...
Oliva
1 month ago
I think pi is a float because it has decimal points, but I'm not entirely sure.
upvoted 0 times
...

Save Cancel