728x90
SMALL
Javascript
JavaScript considers the syntax to end when it breaks.
var jb1 = 'Lorem'
var jb2 = 'Ipsum'
However, if the syntax is not complete, it interprets up to the next line. in short
var jb1
= 'Lorem'
var jb1 = 'Lorem'
The above two methods are the same.
Use a semicolon (;) to clearly indicate that the syntax is finished.
var jb1 = 'Lorem';
var jb2 = 'Ipsum';
Using a semicolon is optional, but when writing multiple constructs on a single line, you must always put a semicolon between the constructs.
var jb1 = 'Lorem'; var jb2 = 'Ipsum'
It's not often necessary to put a semicolon to distinguish the syntax, but it's always a good idea to put it at the end of the syntax for readability and error prevention.
728x90
LIST
'Javascript' 카테고리의 다른 글
[JavaScript] JavaScript/operator/typeof operator (0) | 2022.08.01 |
---|---|
[Javascript] JavaScript / operator / comparison operator (0) | 2022.07.29 |
[Javascript] JavaScript / data type / string (0) | 2022.07.29 |
[Javascript] Add a comment (0) | 2022.07.27 |
[Javascript] How to insert JavaScript into an HTML document (0) | 2022.07.27 |