From the course: Learning the JavaScript Language
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Readability: Whitespace - JavaScript Tutorial
From the course: Learning the JavaScript Language
Readability: Whitespace
- [Instructor] In this video, we're going to talk about how to make your code more readable through the use of whitespace. In other words, spaces, returns, and so forth. I have at the top of this file a little block of code that assigns a few variables individually. There's pretty much no whitespace at all here, but it does work. If I copy and paste that into my node terminal here, I can see that all those variables have actually been assigned. It's just not that easy to read. So what we want to do is add a little whitespace, just a few spaces here and there. That whitespace is generally ignored by JavaScript, but it does make the code much easier to read. Now you can go totally crazy, adding a whole bunch of space in between all of these pieces. Functionally, all of these are the same. But it's possible to go overboard like this and have so much space that the code gets hard to read in a different way. It is also…
Contents
-
-
-
-
-
Objects4m 13s
-
(Locked)
Using objects for data modeling2m 33s
-
(Locked)
Manipulating objects4m 24s
-
(Locked)
Jargon: References4m 39s
-
(Locked)
Arrays5m 35s
-
(Locked)
Manipulating arrays7m 36s
-
(Locked)
Readability: Whitespace3m 24s
-
(Locked)
Readability: Comments4m 57s
-
(Locked)
Regular expressions6m 9s
-
-
-
-
-
-