JavaScript Basic Programs for Beginners
JavaScript Basic Programs for Beginners - Important Points
16. | What is the output of the following code snippet? console.log("hello".length); |
---|
A. hello
B. 5
C. null
D. undefined
View Answer Discuss Work SpaceAnswer: option b
Explanation:
17. | Which of the following is the correct way to add an element to the end of an array in JavaScript? |
---|
A. myArray.push(newElement);
B. myArray.add(newElement);
C. myArray.insert(newElement, myArray.length);
D. myArray[myArray.length] = newElement;
View Answer Discuss Work SpaceAnswer: option a
Explanation:
18. | What is the output of the following code snippet? console.log(2 * "3"); |
---|
A. 5
B. 6
C. 9
D. 23
View Answer Discuss Work SpaceAnswer: option b
Explanation:
19. | Which of the following is the correct way to remove an element from the end of an array in JavaScript? |
---|
A. myArray.removeLast();
B. myArray.pop();
C. myArray.delete(myArray.length);
D. myArray[myArray.length] = null;
View Answer Discuss Work SpaceAnswer: option b
Explanation:
20. | What is the output of the following code snippet? console.log(typeof undefinedVariable); |
---|
A. number
B. string
C. boolean
D. undefined
View Answer Discuss Work SpaceAnswer: option d
Explanation: