JavaScript Datatypes and Variables
JavaScript Datatypes and Variables - Important Points
31. | Which of the following is not a valid way to declare a function in JavaScript? |
---|
A. function myFunc() {}
B. let myFunc = function() {};
C. const myFunc = () => {};
D. All of the above are valid
View Answer Discuss Work SpaceAnswer: option d
Explanation:
32. | Which of the following is a valid way to declare and initialize an object with multiple properties in JavaScript? |
---|
A. var myObj = {key1: "value1", key2: "value2"};
B. let myObj = {"key1": "value1", "key2": "value2"};
C. const myObj = {key1: "value1", key2: "value2"};
D. All of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
33. | Which of the following is not a valid way to declare and initialize a string variable in JavaScript? |
---|
A. var myStr = "Hello";
B. let myStr = 'World';
C. const myStr = JavaScript;
D. myStr = "Programming";
View Answer Discuss Work SpaceAnswer: option d
Explanation:
34. | What is the data type of a variable that stores an undefined value in JavaScript? |
---|
A. Undefined
B. Null
C. Object
D. None of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
35. | Which of the following is a valid way to declare and initialize a number variable in JavaScript? |
---|
A. var myNum = 42;
B. let myNum = 3.14;
C. const myNum = -99;
D. All of the above
View Answer Discuss Work SpaceAnswer: option d
Explanation: