+ 4
Shortcut key to get semicolon(;) at the end of a line.
Does anyone know how to automatically append a semicolon-';' at the end of a statement in JS or other related programming languages, even when your cursor is somewhere in between the line? I've seen instructors in tutorials and such do this and have always wondered how exactly it's being done. I tried looking it up but it's mostly suggesting plugins and stuff in the editor that's being used. Any heads-up on this would be much appreciated.
5 Respostas
+ 2
There could be many different approaches but all of them depend on your editor / IDE.
This one list many solutions for VS Code:
https://stackoverflow.com/questions/30118344/how-to-add-semicolon-to-the-end-of-the-line-in-visual-studio-code
- key bindings / macros
- plugins
- configuration
- autoformatter
The easiest manual way is press End key to jump to the end of line, then press ; key :)
+ 3
I don't think there would be any shortcut because it will add after every line even after any condition like if else block or any other line where should not be semicolon (;). In this case you will have to remove manually after those blocks.
Some languages don't use semicolon even in JS also it is not necessary but some language strictly follow this like Java, C, C++.
+ 2
A͢J so it depends on the editor also that we use?
+ 2
Tibor Santa Thanks, I guess this is the most viable option. 👍
+ 1
Python program