Skip to content
Maker's Aid Logo

Maker's Aid

  • Apps & How-to’s
  • Gear & Guides
  • Digital & Growth
  • UX & Design
  • Web & Code

Category: JavaScript

How to Wait for an Element to Exist in JavaScript

Learn about the two ways to wait until a DOM element exists before executing a JavaScript function.

Published July 13, 2023By Dim Nikov
Categorized as JavaScript

How to Check If a Function Exists in JavaScript

Learn how to check if a function exists or not using the typeof operator in JavaScript.

Published July 13, 2023By Dim Nikov
Categorized as JavaScript

How to Remove Numbers From a String With RegEx

This tutorial will teach you how to match and remove all the numbers in a string using RegEx.

Published July 13, 2023By Dim Nikov
Categorized as JavaScript

How to Check If a String Is a Number in JavaScript

Learn about the three best ways to check if a string is a number in JavaScript, and when to use each.

Published July 13, 2023By Dim Nikov
Categorized as JavaScript

How to Link to JavaScript in HTML

Learn the ins and outs of linking to JavaScript script files from your HTML documents.

Published July 11, 2023By Dim Nikov
Categorized as JavaScript

How to Call a JavaScript Function in HTML

Everything you need to know about calling JavaScript functions in an HTML document—incl. placement, async/defer, and sync.

Published July 11, 2023By Dim Nikov
Categorized as JavaScript

How to Check If an Object Is Empty in JavaScript

Learn three ways to check if an object is empty in JavaScript.

Published July 10, 2023By Dim Nikov
Categorized as JavaScript

Redirect to URL With Parameters in JavaScript

This tutorial will teach you how to redirect the user to a new URL while preserving and/or adding URL parameters.

Published July 10, 2023By Dim Nikov
Categorized as JavaScript

How to Get the Value of Text Input in JavaScript

Learn how to get the value of one or multiple text input fields in JavaScript, with annotated code samples.

Published February 16, 2023By Dim Nikov
Categorized as JavaScript

How to Add an Element to the DOM in JavaScript

Learn how to add DOM elements to an HTML document with confidence using pure JavaScript.

Published February 16, 2023By Dim Nikov
Categorized as JavaScript

Getting the Parent of an Element in JavaScript

Learn how to get the parent of a DOM element in JavaScript, and which unreliable methods to avoid.

Published February 15, 2023By Dim Nikov
Categorized as JavaScript

JavaScript Function With an Optional Parameter

Learn the two best ways to declare a JavaScript function with an optional parameter (and how to give the optional parameter a default value).

Published February 13, 2023By Dim Nikov
Categorized as JavaScript

How to Find Objects in Arrays With JavaScript

Learn how to find objects within arrays of objects in JavaScript, and how to reference their properties the right way.

Published February 13, 2023By Dim Nikov
Categorized as JavaScript

How to Store Objects in JavaScript Arrays

Learn how to store a JavaScript object in an array — and how to reference that object or its individual properties in that array.

Published February 13, 2023By Dim Nikov
Categorized as JavaScript

How to Generate a Random String With JavaScript

Learn about the three best ways to generate a random string with JavaScript, and in which situation to use each.

Published February 12, 2023By Dim Nikov
Categorized as JavaScript

Check If an Array Contains a Value in JavaScript

Learn about the four best ways to check if an array contains a given value in JavaScript, with code samples.

Published February 12, 2023By Dim Nikov
Categorized as JavaScript

How to Get the Port Number in JavaScript

Learn about the fastest and most practical way to get the port number of the current URL in JavaScript, without the B.S.

Published February 12, 2023By Dim Nikov
Categorized as JavaScript

How to Get the Current URL in JavaScript

Learn how to get the current URL of the web page, with or without URL parameters and URL fragments.

Published February 12, 2023By Dim Nikov
Categorized as JavaScript

How to Create a 2D Array in JavaScript

Learn how to create a multi-dimensional array in JavaScript, and how to reference the items in it for your web app’s needs.

Published February 12, 2023By Dim Nikov
Categorized as JavaScript

Remove an Element From an Array in JavaScript

Not sure how to remove an item from an array in JavaScript? We’ll walk you through the best methods and help you pick the right one for you.

Published February 11, 2023By Dim Nikov
Categorized as JavaScript

The Developer’s Guide to localStorage

Learn the ins and outs of localStorage, the persistent Storage object that you can use for storing data in the browser.

Published February 10, 2023By Dim Nikov
Categorized as JavaScript

The Developer’s Guide to sessionStorage

Learn the ins and outs of sessionStorage, the session-scoped Storage object that you can use for temporarily storing data in the browser.

Published February 9, 2023By Dim Nikov
Categorized as JavaScript

How to Comment Out JavaScript

Learn how to comment out JavaScript code, what to watch out for, and how to prevent it from slowing down your website or app.

Published February 7, 2023By Dim Nikov
Categorized as JavaScript

How to Loop Through an Array in JavaScript

Look for the best ways to loop through arrays in JavaScript? Learn the ins and outs of for, while, forEach, map, and for…of loops.

Published February 7, 2023By Dim Nikov
Categorized as JavaScript

How to Format the Date in JavaScript

Learn how to format the date and how to show the date without the time with just a couple of lines of code in vanilla JavaScript.

Published February 6, 2023By Dim Nikov
Categorized as JavaScript

How to Create a Multiline String in JavaScript

Need to create a multi-line string in your JavaScript code? Not sure how exactly to do that? We’ll walk you over the three best ways.

Published February 4, 2023By Dim Nikov
Categorized as JavaScript

How to Set Cookies With JavaScript

Ready to become a JavaScript cookie monster? Let’s get those cookies set and show the browser who’s boss.

Published January 13, 2023By Dim Nikov
Categorized as JavaScript

How to Start Learning JavaScript

Start your coding journey off on the right foot by learning the basics of JavaScript. Check out our latest article on where to begin.

Published December 16, 2022By Dim Nikov
Categorized as JavaScript

Convert Node List to Array in JavaScript

Learn how to convert a NodeList object to an Array in this no-B.S. tutorial.

Published November 23, 2022By Dim Nikov
Categorized as JavaScript

How to Get Today’s Date in JavaScript

Not sure how to get today’s date and time in JavaScript? This guide will walk you through the process step by step and with code samples.

Published October 19, 2022By Dim Nikov
Categorized as JavaScript, Web & Code

Troubleshoot Unexpected Identifier Errors in JavaScript

No, you’re not trying to solve the unsolvable. Here’s how to handle unexpected identifier errors in your JavaScript code.

Published October 19, 2022By Dim Nikov
Categorized as JavaScript, Web & Code

How to Calculate String Length in JavaScript

Calculating a string’s length in JavaScript, for beginners. Everything you need to know (and nothing you don’t).

Published October 19, 2022By Dim Nikov
Categorized as JavaScript, Web & Code

How to Calculate Tax With JavaScript

The best way to calculate tax with JavaScript (and the pitfalls to watch out for as you do).

Published October 18, 2022By Dim Nikov
Categorized as JavaScript, Web & Code

How to Iterate Over a Map Object in JavaScript

Are you stuck? Don’t worry, we’ve got you. We’ll show you how to iterate over a map object in JavaScript like a pro.

Published October 18, 2022By Dim Nikov
Categorized as JavaScript, Web & Code

How to Get an Object’s Class Name in JavaScript

You might not know this, but JavaScript isn’t a class-based programming language as other languages are. So let’s talk about your options.

Published October 18, 2022By Dim Nikov
Categorized as JavaScript, Web & Code

Check If a String Contains a Substring in JavaScript

Does your string contain ___? There’s a simple way to check. Here’s how to search strings for substrings like a pro.

Published October 18, 2022By Dim Nikov
Categorized as JavaScript, Web & Code

How to Check If a Variable Is/Is Not Null in JavaScript

Not quite sure how to check if a variable is (or isn’t) null in JavaScript? Don’t worry, we got you. This guide will show you the ropes.

Published October 17, 2022By Dim Nikov
Categorized as JavaScript, Web & Code

How to Convert Map to Array in JavaScript

This tutorial will show you how to convert a Map object’s keys, values, or key/value pairs to an Array object in JavaScript.

Published October 17, 2022By Dim Nikov
Categorized as JavaScript, Web & Code

Declare vs. Assign in JavaScript

What’s the difference between declaring a constant or variable and assigning it a value? Here’s everything you need to know.

Published April 12, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

How to Get URL Parameters in JavaScript

How to get all or one of the parameters from the URL of the current page in JavaScript with vanilla JavaScript.

Published April 11, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

How to Get the Page Path in JavaScript

This tutorial will show you how to get the current page path in JavaScript (and more).

Published April 10, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

How to Get the Current Domain Name in JavaScript

This tutorial will show you how to get the current domain name in JavaScript (and more).

Published April 9, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

How to Declare a Global Variable in JavaScript

The two ways to declare a global variable in JavaScript, inside and outside of a function.

Published April 8, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Remove Special Characters From a String in JavaScript

Remove special characters from any string with the String.replace() method and well-written RegEx. We show you how!

Published March 29, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

What Is a Data Layer?

A web developer’s introduction to the data layer, a must-have for advertising and marketing on websites and web applications.

Published March 28, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Event Listeners for Multiple Elements in JavaScript

Here’s how to add an event listener for multiple DOM elements in JavaScript.

Published March 27, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

How to Get the Href of a Clicked Link in JavaScript

Learn how to get the href attribute of any, or specific, clicked links in JavaScript.

Published March 27, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

How to Get the Class of a Clicked Element in JavaScript

Learn how to get the class of any, or specific, DOM element that the user clicks by creating an event listener.

Published March 27, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

How to Get the ID of a Clicked Element in JavaScript

Learn how to get the id of any, or specific, DOM element that the user clicks by creating an event listener.

Published March 27, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Array to String Without Commas in JavaScript

How to convert an array into a string without commas with the Array.join() method in JavaScript.

Published March 27, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

How to Run JavaScript on a Mac (4 Ways)

Want to run JavaScript code on your Mac? Here’s how to do it in the Terminal and from your browser.

Published March 26, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Removing All Commas From a String in JavaScript

So you need to remove commas from a string in JavaScript? These are the two best ways to achieve this.

Published March 23, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Create an Array of Images in JavaScript (Tutorial)

The best ways to create and use arrays of images in JavaScript.

Published March 22, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Check If a Button Is Clicked in JavaScript

This is the best way to listen to click events for a button element.

Published March 20, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Is Inline JavaScript Bad?

Wondering whether to inline your JavaScript code or load it externally from a file? We help you decide.

Published March 20, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Why Is My JavaScript Not Working? (With Examples)

We round up the most common causes for your JavaScript code not working.

Published March 20, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Log the User Out on Closing the Browser in JavaScript

Want to log out your user after they’ve closed the tab or window? Here’s how you could do this in JavaScript.

Published March 20, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Set an Attribute Without a Value in JavaScript

The best ways to set an empty attribute to one or multiple DOM elements in your HTML markup, with plain JavaScript.

Published March 19, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Remove Quotes From String in JavaScript

We look at the simplest, most straightforward way to remove quotes from a string in JavaScript.

Published March 15, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Pass PHP Array to JavaScript (Tutorial)

It turns out you can get PHP and JavaScript to agree on something, and that something is the JSON data format.

Published March 14, 2022By Jim Stonos
Categorized as JavaScript, PHP, Web & Code

Nested Arrays in JavaScript, Explained

You asked for it, we delivered. We explain nested arrays in a way that anyone, from beginner to expert, can understand.

Published March 13, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

How to Declare an Empty Array in JavaScript

Here’s how to declare an empty array object in JavaScript—and what you need to do so that it meets your needs.

Published March 13, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Function Not Defined in JavaScript (How to Fix It)

ReferenceErrors are annoying. These common mistakes and clues to look for will help you get to the meat of it.

Published March 13, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Alphabet Array in JavaScript (Tutorial)

The simplest, most straightforward ways to create an array of letters in the English alphabet in JavaScript.

Published March 13, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Find the Largest Number in an Array in JavaScript

The quick and easy way to find the largest number in an array in JavaScript.

Published March 13, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Quotes Within Quotes Within Quotes in JavaScript

There’s a way to nest string in two or more quotes in JavaScript, and you will love the simplicity of it.

Published March 12, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Adding a New Line in JavaScript (Tutorial)

Still learning? These are the best ways to add a new line to your JavaScript code’s output.

Published March 11, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

How to Repeat a String in JavaScript (Tutorial)

In JavaScript, it’s easier to repeat a string an n number of times than you probably think. Here’s how to do it.

Published March 11, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Check If an Element Has a Class in JavaScript

So you’re looking for a good way to check if a DOM element has a CSS class in JavaScript?

Published March 10, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

Check If String Is Empty in JavaScript

Find out the two best ways to check whether a string is empty or not in JavaScript.

Published March 9, 2022By Jim Stonos
Categorized as JavaScript, Web & Code

About

We publish growth advice, technology how-to’s, and reviews of the best products for entrepreneurs, creators, and creatives who want to write their own story.

Learn more →

Disclaimer

Maker's Aid is a participant in the Amazon Associates, Impact.com, and ShareASale affiliate advertising programs.

These programs provide means for websites to earn commissions by linking to products. As a member, we earn commissions on qualified purchases made through our links.

Explore

  • Apps & How-to's
  • Audio & Visual
    • Photography
  • Digital & Growth
    • Ads
    • Analytics
    • Blogging
    • Copywriting
    • Marketing
  • Gear & Guides
  • News
  • UX & Design
    • Canva
    • Photoshop
  • Web & Code
    • CSS
    • Domains & Hosting
    • HTML
    • JavaScript
    • PHP
    • WordPress

Tools

  • CSS Performance Testing
Maker's Aid Logo
  • Home
  • About Us
  • Contact Us
  • Sitemap
  • Terms of Use
  • Cookie Policy
  • Privacy Statement
  • Disclaimer
Copyright © Maker's Aid, 2020 — 2025
Manage your privacy

To provide the best experiences, we and our partners use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us and our partners to process personal data such as browsing behavior or unique IDs on this site and show (non-) personalized ads. Not consenting or withdrawing consent, may adversely affect certain features and functions.

Click below to consent to the above or make granular choices. Your choices will be applied to this site only. You can change your settings at any time, including withdrawing your consent, by using the toggles on the Cookie Policy, or by clicking on the manage consent button at the bottom of the screen.

Functional cookies Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preference cookies
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics cookies
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Advertising & marketing cookies
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Statistics

Marketing

Features
Always active

Always active
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
Manage options
{title} {title} {title}
Manage your privacy
To provide the best experiences, we and our partners use technologies like cookies to store and/or access device information. We use this data to help us to understand what content resonates with our readers and to improve and personalise their experience.
Functional cookies Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preference cookies
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics cookies
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Advertising & marketing cookies
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Statistics

Marketing

Features
Always active

Always active
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
Manage options
{title} {title} {title}