Skip to content

Latest commit

 

History

History
16 lines (10 loc) · 772 Bytes

what_is_an_empty_statement_and_purpose_of_it.md

File metadata and controls

16 lines (10 loc) · 772 Bytes

What is an empty statement and purpose of it?

An empty statement in JavaScript is a statement that does nothing. It is represented by a semicolon (;) on its own. Although it does not perform any action, it can be used in loops, conditionals, or in places where a statement is syntactically required.

Example:

for (let i = 0; i < 5; i++) { ; }
// No operation happens in the loop, but the loop is still valid

Tags: basic, JavaScript, statements

URL: https://www.tiktok.com/@jsmentoring/photo/7462028520613547296