JavaScript Best Practices and Coding Conventions - Write Clean Code

preview_player
Показать описание
❗ IMPORTANT:

Use the special promo code "JSM_YT_SQUAD" on checkout to save $50!

In this video we we look at some of the best practices and coding conventions for JavaScript. We're going to go through a number of rule that can help you write clean code. If you stick to the rules stated in this video and write clean JavaScript code, people will perceive your work differently.

Coding conventions secure quality, improve code readability and make code maintenance easier. They can be documented rules for teams to follow, or just be your individual coding practice.

Following coding conventions can help make your code more consistent, predictable and readable.

Writing clean code is a benefit both to you and your co-workers. Why? Can you remember a time when you carried out a code review and had to question what was happening in a specific function. If you have, then it means the code probably could’ve been cleaner. It’s something we should aspire to do.

Рекомендации по теме
Комментарии
Автор

3:18 we can do, so called, array destructurong to get the value in nested array. The code for that will be,

let exampleArray = [[["value"]]];
let [[[a]]] = exampleArray;

console.log(a);

The above code will store the value inside 'a' variable which can then be used anywhere inside our program

huzaifahashmiofficial
Автор

Thanks so much for thoses conventions asserting my daily use choice. I have no senior JS around so it's great to double check and see others are confirming one's approach.

laurelineparis
Автор

A looot of senior devs suggest having comments because there's only so much self explaining a code base can be. Idk why people are against comments, they make other's life simple

fawazsullia
Автор

Saved for future reference! Thanks for making these awesome videos, keep it up . 👏🏽👏🏽👏🏽

Roshen_Nair
Автор

its useful to follow the ff convention to avoid headache in the future. thank you for the ff example to clarify all possible scenario.

jggabayno
Автор

10:48 Which shortcut do you use to do those modifications with just in one click?

salvatoregurzi
Автор

This is some great content man wow! I am sad I didnt know about you earlier but I am super happy that I am here now and I can learn all these.

I wanted to ask though : which vs code extension are you using for replacing words by clicking?

theegreatestever
Автор

Amazing tutorial <3 Thankyou soo much for making one for us

waleedful
Автор

4:29 one liner solution :
//return "value";

ngtyt
Автор

Thanks for your amazing efforts and it really helped me alot

salemabdulsamad
Автор

also for the MakeCar example, it's ok to use CarMaker or CarFactory, which produces a new Car object in a certain way

TodorescuProgramming
Автор

Very well explained with to the point! If video screen have been split with console could have much better for result as well... also as mention by @Tudor instead of get prefix fetch will add better definition to variable..

Nice and Thanks a ton! Saved for future reference...

shirishdhotre
Автор

Guys, be carefully! On 3:59 screamer. I became blind XD

TheMrAlkotras
Автор

1:43 "Do you have any idea what this means"
Me *who has a trauma working with Dates*: "Hell i know this man as if it was my brother!'

felixbruggemann
Автор

This is sorely needed for most devs.. Don't use str_ or m_ or _var.. Use highestValueCalculator or addInputs...

ChristianHowell
Автор

Please make a video on MERN Project With Login, Logout, JWT, Mongo, with Add Post like post delete post comments etc.

hamzaashraf
Автор

Very useful video! May I ask you what VS Code addon do you use for the colored indents?

zoltan_meszaros
Автор

Destructuring is really important. But, it’s not really an issue of code duplication.

It’s certainly code consolidation. It’s reducing the lines a thing appears on. But, you’re still doing the exact same thing.

In memory or time it’s the same.

If you’ve taken a block of code and duplicated it you’ve bloated your code to some extent.

At a certain point with destructing each individual thing you destructure will be on a separate line. At a certain point it’s basically taking up the same number of lines (imagine destructuring 20 variables).

In that case destructuring is still best practice but in general it’s just a style thing. Failing to adhere to DRY principles with duplicated code can readily cause bugs if needs change and some parts get updated and others do not.

zero
Автор

Why does my JavaScript have different syntax highlighting in vscode

mattshu
Автор

You have an error on the class definition when adding the equal `=` character

gsolano