JavaScript Basic Programs for Beginners
JavaScript Basic Programs for Beginners - Important Points
21. | What is the output of the following code snippet? console.log("hello".toUpperCase()); |
---|
A. hello
B. HELLO
C. null
D. undefined
View Answer Discuss Work SpaceAnswer: option b
Explanation:
22. | Which of the following is the correct way to concatenate two strings in JavaScript? |
---|
A. string1.concat(string2);
B. string1 + string2;
C. string1.join(string2);
D. string1.append(string2);
View Answer Discuss Work SpaceAnswer: option b
Explanation:
23. | What is the output of the following code snippet? console.log(2 + "3"); |
---|
A. 23
B. 5
C. null
D. undefined
View Answer Discuss Work SpaceAnswer: option a
Explanation:
24. | Which of the following is the correct way to check if a variable is an array in JavaScript? |
---|
A. if (typeof myArray === "array") {}
B. if (myArray.isArray()) {}
C. if (myArray === "Array") {}
D. if (Array.isPrototypeOf(myArray)) {}
View Answer Discuss Work SpaceAnswer: option b
Explanation:
25. | What is the output of the following code snippet? console.log(Math.random() * 10); |
---|
A. a random number between 1 and 10
B. a random number between 0 and 10
C. 10
D. null
View Answer Discuss Work SpaceAnswer: option b
Explanation: