Question 18
Back to Exercise
What does the following JavaScript code print (console output, as in Node.js)?
console.log("ab".concat("cd", 1, null, [2, 3]));
- A abcd1null2,3 Correct
- B abcd1
- C abcd1null[2,3]
- D TypeError
Correct Answer: Option A
concat converts each argument to a string: 1 → "1", null → "null", [2, 3] → "2,3".
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!