JavaScript Datatypes and Variables
JavaScript Datatypes and Variables - Important Points
6. | What is the data type of a variable that stores a boolean value in JavaScript? |
---|
A. Boolean
B. Number
C. String
D. Object
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The Boolean data type is used for storing true or false values in JavaScript.
7. | What is the data type of a variable that stores a string value in JavaScript? |
---|
A. String
B. Number
C. Boolean
D. Object
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The String data type is used for storing textual data in JavaScript.
8. | Which of the following is a valid way to declare a constant in JavaScript? |
---|
A. var myConst = 1;
B. let myConst = 1;
C. const myConst = 1;
D. const = 1;
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The const keyword is used to declare constants in JavaScript.
9. | What is the data type of a variable that stores an array in JavaScript? |
---|
A. Object
B. Array
C. List
D. Set
View Answer Discuss Work SpaceAnswer: option a
Explanation:
In JavaScript, arrays are a type of object.
10. | Which of the following is not a primitive data type in JavaScript? |
---|
A. Number
B. String
C. Object
D. Boolean
View Answer Discuss Work SpaceAnswer: option c
Explanation:
Objects are not primitive data types in JavaScript. They are complex data types.