+ 2

Is it important using semicolon?

Is it important using semicolon ; ? Because my code below is also working well (without semicolons)↓↓ var x = 100 console.log(x) Sorry for my bad engish.

11th Aug 2021, 8:05 AM
Fꫀⲅძ᥆͟ᥙ᥉᯽
Fꫀⲅძ᥆͟ᥙ᥉᯽ - avatar
5 Antworten
+ 8
Yeah, but not in javascript. It's not necessary to write an` ; `at the end unless you are writing two lines of code in the same line. I mean var x = 100 console.log(x); console.log(x+2)
11th Aug 2021, 8:14 AM
Simba
Simba - avatar
+ 3
MD. Ferdous Ibne Abu Bakar Yeah it's important and the reason why your code is running well is because a lot of IDEs have the automating system wich can run the code without using semicolon . But it's important to use it in order to get used on it. Sorry for my bad english too😅😅😅
11th Aug 2021, 8:10 AM
Anoir B'f
Anoir B'f - avatar
+ 3
Yeah, like Simba says that it's useful in writing 2 codes on the same line, it's true. But in languages like JAVA it is NECESSARY, without it your code will crash, so keep habit of using semicolons👍🏻
11th Aug 2021, 8:54 AM
Parth
Parth - avatar
+ 2
Thank you all 😍
11th Aug 2021, 9:16 AM
Fꫀⲅძ᥆͟ᥙ᥉᯽
Fꫀⲅძ᥆͟ᥙ᥉᯽ - avatar
+ 1
In low-level languages like C, the statements are separated by a semicolon instead of a new-line, unlike Python.
11th Aug 2021, 9:46 AM
Calvin Thomas
Calvin Thomas - avatar