LearnFrenzy
Sign in Take a free test

JavaScript Basics · Predict the Output · Question 20

Two lines without semicolons Answer, explanation & discussion

  • Output
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 20 Back to Exercise

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

main.js
const first = "Learn"
const word = first
+ "Frenzy"
console.log(word)
  • A Learn
  • B SyntaxError
  • C LearnFrenzy Correct
  • D Learn Frenzy
Correct Answer: Option C

ASI inserts a semicolon only if the next line cannot continue the statement. A line starting with + can, so the two lines form first + "Frenzy".

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