LearnFrenzy
Sign in Take a free test

JavaScript Basics · Predict the Output · Question 1

console.log with several arguments Answer, explanation & discussion

  • Output
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 1 Back to Exercise

What does the following JavaScript code print (console output, as in Node.js)?

main.js
console.log("Sum:", 2 + 3, "done");
  • A Sum:5done
  • B Sum: 5 done Correct
  • C Sum: 2 + 3 done
  • D Sum:,5,done
Correct Answer: Option B

The expression 2 + 3 is evaluated first, and console.log separates its arguments with one space.

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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links