HTML Vertical Line

You can add a vertical line to your HTML page by using the <div> tag with custom CSS styling. Let’s dive into the details. ...

December 29, 2021 · 1 min · Coderslang Master

Disable any Button with JavaScript

You can disable any HTML button with JavaScript, by setting its disabled property to true. Let’s see how you can locate a specific button and prevent clicks by disabling it. ...

December 28, 2021 · 1 min · Coderslang Master

How to Create a Confirmation Modal with "yes" and "no" options in JS

A JavaScript confirm function is a convenient way to display the confirmation box with the “OK” and “Cancel” options and capture user’s response. Let’s see how it’s done. ...

December 27, 2021 · 1 min · Coderslang Master

How to add a line break in HTML

You can add a line break in HTML using the <br> tag. It works in all browsers. The <br> tag is a so-called “empty tag”, which means it doesn’t need a closing tag....

December 26, 2021 · 1 min · Coderslang Master

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