🚀 CYBER WEEK SALE: 50% OFF on JavaScript Fundamentals 💪

How to add a new line to a JavaScript string

You can add a line break to your JavaScript strings, by using the \n symbol or backticks. Here’s how it’s done. ...

December 25, 2021 · 1 min · Coderslang Master

JavaScript Array to String

There are 3 common ways you can convert any JavaScript array to string: The built-in toString method to get all the array elements split by commas The JSON.stringify function to get the JSON representation of a JavaScript array The join method to use a custom separator Transform JS array to a string with toString To transform any JavaScript array to a string, you can use the built-in toString method...

December 24, 2021 · 2 min · Coderslang Master

Exclude node_modules using gitignore file in your JavaScript project

The node_modules directory is an integral part of any JS project. However, it makes sense to exclude it from your git commits. You can remove node_modules from the remote repository by adding it to the .gitignore file. ...

December 23, 2021 · 1 min · Coderslang Master

What is .gitignore and how to use it

The .gitignore is a plain-text file. It allows you to specify files and folders that you’d like to exclude from your git commits. .gitignore should be placed in the root directory of your git project. ...

December 22, 2021 · 1 min · Coderslang Master

How to use async and await in a forEach JS loop

The problem with using async/await in a forEach loop in JavaScript is the fact that you can’t wait for the promise resolution. Let’s see how you can fix it. ...

December 21, 2021 · 3 min · Coderslang Master

What is the Scope of Variables in JavaScript

There are 4 types of scope in JavaScript: global scope, block scope, function scope, and module scope. Global scope The top-level scope in JavaScript is called the global scope. When you declare a variable in the global scope it’s going to be accessible in all your functions and code blocks....

December 20, 2021 · 2 min · Coderslang Master

What are the JavaScript Design Patterns

Design patterns are blueprint solutions to common programming problems. Most of the credit for classifying and describing the design patterns goes to the “Gang of Four” - Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides....

December 19, 2021 · 1 min · Coderslang Master

How to get access to the object property in JavaScript

There are 2 ways to get access to the object properties in JS: Dot notation: user.name Square bracket notation: user['name'] In both cases we’ll get access to the property name of the object user....

December 18, 2021 · 1 min · Coderslang Master

How to get dynamic access to an object property in JavaScript

To get started with the dynamic access to object properties in JS, let’s first take a look at how you could get access to a static object property. const user = { age: 25, name: 'Jack' } console....

May 7, 2022 · 1 min · Coderslang Master

How to get query params in Express

In Express.js all the query parameters are stored in the object req.query, so you can access them in any of your route handlers or middleware functions. So imagine your Express backend is running on https://learn....

December 16, 2021 · 1 min · Coderslang Master