Does anybody know how to comment a syntax of code in repl.it editor ??
What do you mean with “comment”?
In JavaScript you can always add comments with //
in front of it
All languages have their own way to add comments
in which language? it’s not specific to the editor, it’s specific to the language. Probably //
Yes Guyz I am asking for javascript syntax. When I write code in repl.it for practise, suppose now I want to write another code of lines for that I need to comment the previous one. But, when I select code and comment it by using // it deletes it. Is there any short cut or method for it ?? I saw some tutorials videos of javascript in which the lecturer just select the code and press // it comments it. But in my case it deletes the code.
you need to add // in front of the code, not select and then type
or if you have a block of code you want to comment (as in more than one line) write /*
before and */
after the block of code
and if you right click and choose “Command Palette” it will show you all the shortcuts you can use
@ilenia I am not getting ur first point. suppose I want to comment a block of code then I’ll need to just go on the first line of code and need to add //. Isn’t like that ??
If you use //
then the rest of the line is commented out
If you want different lines commented out you need to add /*
at the beginning and */
at the end
// this is a signle-line comment
/* this is
a multi-line
comment */
He is saying to comment a block of code, format looks like this:
/*
Block
Of
Code
*/
Or for single line:
// line of code
Yes I get and I go with second option every time. But I’ve seen in many video tutorials lecturer just select the code and press //. The entire code will be commented. Sorting out how to do that. Will share video then might u can see and sort it out.
They certainly don’t use just //
as a shortcut
Check the command palette (right click -> command palette)
I remember something like below but I may be completely wrong as I don’t have it in front on me
The short cut for single line comment is Ctrl+K Ctlr+C
Really? It should be Ctrl+/
It is in the Command Palette of the editor… I didn’t choose it myself
Ctrl+K Ctrl+C adds // to the beginning, Ctrl+/ toggles comment. Ctrl+/ is the more common one too
And easier to press.
Thank you guyz for helping me out.
We can use both either ctrl+/ or ctrl+k ctrl+c
But if you want to toggle, use Ctrl+/