
Explore clean code in JavaScript by defining clean, understandable code using keep it simple, stupid and DRY principles, emphasizing maintainability, debugging, and scalable feature development.
Share practical clean code guidance for JavaScript developers across French and English communities. Originated in French for deaf theory and later recorded in English to broaden access.
Choose camelCase for most JavaScript variables, reserve PascalCase for classes, and avoid kebab-case in identifiers; snake_case is rarely used in JavaScript and used in Python.
Name variables with meaningful, context-revealing, detailed names like user or customer to reflect the object. Prefix booleans with is and rename items for clearer intent, avoiding formatting and imprecise names.
Refactor variable names to remove redundant words, using user instead of user data and product instead of product list to reveal their true content.
Be explicit from the start with descriptive variable names in JavaScript, avoiding one-letter identifiers, clarifying loop variables like day of the week, to ease refactoring and feature additions.
Explains why the traditional uppercase snake_case naming for constants is outdated in modern JavaScript tooling, and advocates environment variable conventions and replacing magic numbers with named constants like max executions.
Learn to name JavaScript functions with a leading verb, maintain consistency in the chosen verb, and use descriptive, context-rich names like fetch article by category to convey exact behavior.
learn to keep functions small and focused by ensuring a single purpose, refactoring into helper functions like validate login fields, and lowering abstraction levels to improve readability.
Limit function parameters to two, or three at most, to keep code simple. When needed, pass a single object parameter for updates like a user address to improve readability.
Master default values in JavaScript by using default parameters and merging a default config with user input through Object.assign to produce a final config object.
Understand flag parameters and how they trigger different paths at the start of a function. Refactor by splitting into two small functions when behavior diverges, avoiding repetition.
Avoid global variables in JavaScript by passing data through parameters, ensure functions are pure and immutable, and return new values rather than mutating inputs.
Balance functional programming and object oriented programming by favoring simple functions for maintainability and refactoring, and reserve classes only when a complex object demands it.
Apply the latest features of classes in JavaScript, including private classes and static properties, and rely on a transpiler to generate code that runs on most browsers.
Master method chaining in JavaScript by returning this from every method, enabling fluent calls like setCategory().setName().save on a task object.
Explore why you should prefer composition over inheritance in JavaScript, building has-a relationships between market orders and markets, and avoiding improper extends.
Never ignore errors; log them with console during development, show a toast to the user when issues occur, and report to an error-tracking system.
Apply the finally clause to ensure code runs after a fetch, replacing repeated logic with a single finally block, embracing the dry principle and resetting the loading state.
Explore the error hierarchy in JavaScript by building a custom error class system with network and validation errors, using inheritance, messages, and instance checks.
Comment only complex logic; remove comments that restate code or function names, and group notes to describe validation steps such as email regex and password checks, improving readability.
Remove commented code to keep a clean code base, rely on version control to view past implementations, and write self-explanatory logic such as email validation and password checks.
Evaluate and remove positional markers in JavaScript code, organize constants and environment variables into dedicated files, and restructure into a utils and database directory to improve clarity and export clarity.
use jsdoc to document functions, including parameter descriptions and the void return, so editors show parameter types and prompts like email and password; automate docs with the document this extension.
Apply clean code principles to your JavaScript projects with this practical wrap-up of the clean code for JavaScript course, focusing on making your Klink JavaScript code cleaner.
Explore tools to go further in clean JavaScript: use linting and formatting, adopt immutability with libraries like immutable.js, embrace TypeScript, and test small functions for fewer bugs.
Here is a condensed course for people who don't have 10 hours free and still want to improve their code.
After following this course of an hour you will be more confident about the readability of your code, and your codebase will be long-term and scalable because of the ease to read and change the code you wrote.
I talk about clean code for every part of javascript :
Variables (19min, available in preview)
Functions (24min)
Classes (12min)
Error handling (13min)
Comments (18min)
The first section about variables is fully in preview, so you can already learn from this course, if you like my style of teaching, then I will try to record other courses about precise JavaScript subject like this one.
My name is Bryan, I'm a french javascript developer and I firstly recorded this course in french but then decided to also do it in english so everyone could quickly improve their code whatever their language.
I already created a lot of courses, on Udemy or on my own platform, but this one is the first I do in english, so please don't expect a perfect english vocabulary, I tried my best !
Finally, I hope this course will benefit you as you expected.
Thank you for reading.