Book Image

Mastering Clean Code in JavaScript [Video]

By : Dimitiris Loukas
Book Image

Mastering Clean Code in JavaScript [Video]

By: Dimitiris Loukas

Overview of this book

Alongside HTML and CSS, JavaScript is one of the three core technologies of World Wide Web content production. You can write terrible code in any language, but if you wanted to try to write terrible code that works, JavaScript would be your language of choice. In this course, you will learn various concepts and techniques, essential principles, patterns, and practices for writing clean code in JavaScript. You will be introduced to some general guidelines on how to better structure your JavaScript code. You will then learn about clean code best practices while working with variables, functions objects, and the latest ES6 classes. Next, you will discover functional programming, how to write pure functions, and how to use built-in functional methods. You will then move on to modular JavaScript and explore the various ways you can structure your modules. After that, you will master various design patterns and programming principles. Unit testing is very important and you will learn to do this with Jasmine and Karma, to make handling errors easy. By the end of the course, you will have learned to learn clean coding with functional programming, explored various modules in JavaScript, and designed patterns and principles. Overall you will learn to write better code with improved readability.
Table of Contents (6 chapters)
Chapter 6
Error Handling
Content Locked
Section 3
An Error Handler with Strategy
The error handler we built in a previous section was a nice start. Now it is time to build an error handler that can fully utilize the strategy pattern. - Explain the strategy pattern one more time - Write a generic error handler that takes two constructor arguments, one for the MessageHandler and one for the Logger - Implement the MessageHandling strategy