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

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