menu

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

Discuss Work Space

Answer: 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

Discuss Work Space

Answer: 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;

Discuss Work Space

Answer: 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

Discuss Work Space

Answer: 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

Discuss Work Space

Answer: option c

Explanation:

Objects are not primitive data types in JavaScript. They are complex data types.


Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now