Comments

4 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€85.25
List Price:  €119.36
You save:  €34.10
£73.64
List Price:  £103.10
You save:  £29.46
CA$136.54
List Price:  CA$191.16
You save:  CA$54.62
A$152.90
List Price:  A$214.07
You save:  A$61.16
S$127.84
List Price:  S$178.98
You save:  S$51.14
HK$784.91
List Price:  HK$1,098.91
You save:  HK$313.99
CHF 79.75
List Price:  CHF 111.65
You save:  CHF 31.90
NOK kr1,008.04
List Price:  NOK kr1,411.30
You save:  NOK kr403.25
DKK kr636.07
List Price:  DKK kr890.52
You save:  DKK kr254.45
NZ$166.30
List Price:  NZ$232.83
You save:  NZ$66.52
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.92
৳12,211.45
List Price:  ৳17,096.53
You save:  ৳4,885.07
₹8,569.99
List Price:  ₹11,998.33
You save:  ₹3,428.34
RM424.05
List Price:  RM593.69
You save:  RM169.64
₦152,960.70
List Price:  ₦214,151.10
You save:  ₦61,190.40
₨28,369.07
List Price:  ₨39,717.84
You save:  ₨11,348.76
฿3,251.32
List Price:  ฿4,551.98
You save:  ฿1,300.66
₺4,001.95
List Price:  ₺5,602.90
You save:  ₺1,600.94
B$548.83
List Price:  B$768.39
You save:  B$219.55
R1,777.80
List Price:  R2,488.99
You save:  R711.19
Лв166.48
List Price:  Лв233.08
You save:  Лв66.60
₩136,992.93
List Price:  ₩191,795.58
You save:  ₩54,802.65
₪335.48
List Price:  ₪469.68
You save:  ₪134.20
₱5,640.83
List Price:  ₱7,897.39
You save:  ₱2,256.56
¥14,639.13
List Price:  ¥20,495.36
You save:  ¥5,856.23
MX$1,863.31
List Price:  MX$2,608.70
You save:  MX$745.39
QR365.01
List Price:  QR511.03
You save:  QR146.01
P1,332.16
List Price:  P1,865.07
You save:  P532.91
KSh12,918.70
List Price:  KSh18,086.70
You save:  KSh5,168
E£4,967.72
List Price:  E£6,955
You save:  E£1,987.28
ብር13,857.24
List Price:  ብር19,400.69
You save:  ብር5,543.45
Kz91,186.38
List Price:  Kz127,664.58
You save:  Kz36,478.20
CLP$94,134.58
List Price:  CLP$131,792.18
You save:  CLP$37,657.60
CN¥717.32
List Price:  CN¥1,004.28
You save:  CN¥286.96
RD$5,975.86
List Price:  RD$8,366.45
You save:  RD$2,390.58
DA12,957.92
List Price:  DA18,141.60
You save:  DA5,183.68
FJ$224.49
List Price:  FJ$314.30
You save:  FJ$89.80
Q768.73
List Price:  Q1,076.25
You save:  Q307.52
GY$20,922.44
List Price:  GY$29,292.25
You save:  GY$8,369.81
ISK kr12,156.78
List Price:  ISK kr17,019.98
You save:  ISK kr4,863.20
DH898.74
List Price:  DH1,258.28
You save:  DH359.53
L1,688.45
List Price:  L2,363.91
You save:  L675.45
ден5,241.33
List Price:  ден7,338.08
You save:  ден2,096.74
MOP$808.61
List Price:  MOP$1,132.09
You save:  MOP$323.47
N$1,772.85
List Price:  N$2,482.06
You save:  N$709.21
C$3,674.55
List Price:  C$5,144.53
You save:  C$1,469.97
रु13,714.52
List Price:  रु19,200.88
You save:  रु5,486.35
S/354.30
List Price:  S/496.04
You save:  S/141.73
K418.62
List Price:  K586.09
You save:  K167.46
SAR375.01
List Price:  SAR525.03
You save:  SAR150.02
ZK2,422.54
List Price:  ZK3,391.66
You save:  ZK969.11
L432.04
List Price:  L604.88
You save:  L172.83
Kč2,101.18
List Price:  Kč2,941.74
You save:  Kč840.55
Ft34,048.67
List Price:  Ft47,669.50
You save:  Ft13,620.83
SEK kr951.26
List Price:  SEK kr1,331.80
You save:  SEK kr380.54
ARS$126,187.92
List Price:  ARS$176,668.14
You save:  ARS$50,480.21
Bs691.04
List Price:  Bs967.49
You save:  Bs276.44
COP$399,183.29
List Price:  COP$558,872.57
You save:  COP$159,689.28
₡50,506.82
List Price:  ₡70,711.57
You save:  ₡20,204.75
L2,608.64
List Price:  L3,652.20
You save:  L1,043.56
₲796,969.17
List Price:  ₲1,115,788.73
You save:  ₲318,819.55
$U4,014.67
List Price:  $U5,620.70
You save:  $U1,606.02
zł361.79
List Price:  zł506.52
You save:  zł144.73
Already have an account? Log In

Transcript

Hello, in this JavaScript video, I am going to show you common thoughts the comment, it allows you to essentially write something that does not get run my thinking, why would I waste time writing something basically coding something that isn't actually even run. And there's two main reasons. One allows you to annotate code. So if you've created some really complex algorithm or some process, and let's say 50 lines of code, it can be difficult to you know, keep track of exactly what's happening, especially if you come back at a later date. Or if somebody else is working on it as well. They don't fully understand it.

If you comment on it, you can, you know, basically give some context of what it does, how it does it. The other reason you can use comments is when we actually get to JavaScript code. Comments allow you to essentially prevent, you know, an actual article from running and that's called content into no code. And the great thing about that is she wrote something's not quite working, maybe break in producing arrows. And he's like, you scratching it, could it be this mine? Or could it be more importantly, could it be these 20 lines I don't want to delete and you know, act and save me or anything like that commented out, code is still there in your editor.

It's just one get run, you can test it and be like, Oh, this one the problem so I can just uncomment it out. So let me show you how it all works. So we can use any other, you know, tags, this one or the file I'm just going to deal deal with and do it in the custom js file just to separate things out. Okay, in here. if let's say we were to just, I'm just going to create a simple variable. I'm actually gonna explain this in a separate video, but just bear with me.

And maybe this is something epic, I can comment it on. I can do that by doing Before slashes, if I write something here, let's say hello, epic, very well, as you can see the text editor gray is set jobs remote, they saw the grayed out color. And what that means is, this is a comment is not going to get run. So if I just save that, go to the website, refresh, go to inspect and go to custom j s file go to. I made a mistake here. This is not meant to be sourced isn't meant to be text.

Make sure you update that. Please reload good sources. As you can see, we've got that right here. And you know, this is why it doesn't produce any errors. Because if something that happened, an error would get kicked off. Here.

It doesn't actually Do anything, okay, so that's one way of doing a comment. The other way which was commenting out to light is to force flashing light. So if you have multiple lines of code, so what I'm going to do quickly create, you know, a bunch of variables assigning the value one. Okay? If you want to comment multiple lines, what you can do is do forward slash Asterix, and this will keep commenting out long till he hit Asterix for slash. So, four slash Asterix opens a multi line comment, and Asterix for slash closes a multi line comment.

If I've got VA, you know, I can call nine by five, like a Intel processor. As you can see it is this right column. So that's it for comment. That's really all you need to know. But make sure you use them. When you do comment yourself.

Code to provide context likely can explain what is happening. Make sure you do it as you go along. Because if you say or do it at the end of the project or at the end of the day or you know, the end of the coding session, what ends up happening, you're tired, you know, you can't be bothered, you get to it. And you say, nah, I'll do it next time I do next time. And commenting is easy. We take such a long time if you let he add up, but you just don't end up doing it.

So make sure you do it as you go along. So that's it for comments. As usual. Any questions, feel free to hit me up and as usual, I look forward to seeing you in my next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.