Advertisement
728x90
The empty statement is a semicolon (;) indicating that no statement will be executed, even if JavaScript syntax requires one. Since there is no action with an empty statement you might think that it's usage is quite less, but the empty statement is occasionally useful when you want to create a loop that has an empty body. For example, you can initialize an array with zero values as below,
javascript
1// Initialize an array a
2
3for (let i = 0; i < a.length; a[i++] = 0);Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 77
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
248of476