Console.log() in javascript

I have noticed that “console.log()” and “console.log();” seem to work. Is there a specific rule or best practice regarding when to include or omit semicolons at the end of statements?

Hi @223j5a4205

In JavaScript, including semicolons at the end of statements is a best practice to avoid potential issues with automatic semicolon insertion. While both “console.log()” and “console.log();” work, it’s recommended to consistently use semicolons to enhance code readability and prevent unexpected behavior.

Happy learning!

I wanted to take a moment to express my sincere gratitude for taking the time to clarify my doubt. Your explanation was incredibly helpful. Thank you.

1 Like