JavaScript Basic Programs for Beginners
JavaScript Basic Programs for Beginners - Important Points
11. | Which of the following is the correct way to create an array in JavaScript? |
---|
A. var myArray = ();
B. var myArray = [];
C. myArray = array();
D. myArray = {};
View Answer Discuss Work SpaceAnswer: option b
Explanation:
12. | What is the output of the following code snippet? console.log(3 === "3"); |
---|
A. 1
B. 0
C. null
D. undefined
View Answer Discuss Work SpaceAnswer: option b
Explanation:
13. | Which of the following is the correct way to access an element in an array in JavaScript? |
---|
A. myArray[elementIndex]
B. elementIndex.myArray
C. myArray[elementValue]
D. myArray[elementIndex][elementValue]
View Answer Discuss Work SpaceAnswer: option a
Explanation:
14. | What is the output of the following code snippet? console.log(5 > 2 && 2 < 4); |
---|
A. 1
B. 0
C. null
D. undefined
View Answer Discuss Work SpaceAnswer: option a
Explanation:
15. | Which of the following is the correct way to write a for loop in JavaScript? |
---|
A. for (var i = 0; i < array.length; i++) {}
B. for (i = 0; i < array.length; i++) {}
C. for (var i = 0; i < array.length; i--) {}
D. for (i = 0; i < array.length; i = i + 2) {}
View Answer Discuss Work SpaceAnswer: option a
Explanation: