Ready to become a JavaScript cookie monster? Let’s get those cookies set and show the browser who’s boss.
Category: 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.
Convert Node List to Array in JavaScript
Learn how to convert a NodeList object to an Array in this no-B.S. tutorial.
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.
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.
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).
How to Calculate Tax With JavaScript
The best way to calculate tax with JavaScript (and the pitfalls to watch out for as you do).
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.
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.
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.
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.
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.
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.
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.
How to Get the Page Path in JavaScript
This tutorial will show you how to get the current page path in JavaScript (and more).
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).
How to Declare a Global Variable in JavaScript
The two ways to declare a global variable in JavaScript, inside and outside of a function.
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!
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.
Event Listeners for Multiple Elements in JavaScript
Here’s how to add an event listener for multiple DOM elements in JavaScript.
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.
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.
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.
Array to String Without Commas in JavaScript
How to convert an array into a string without commas with the Array.join() method in JavaScript.
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.
Check If a String Has Only Numbers in JavaScript
So you need to implement validation for your app’s frontend or backend. Here’s how to do it with RegEx.
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.
Create an Array of Images in JavaScript (Tutorial)
The best ways to create and use arrays of images in JavaScript.
Check If a Button Is Clicked in JavaScript
This is the best way to listen to click events for a button element.
Is Inline JavaScript Bad?
Wondering whether to inline your JavaScript code or load it externally from a file? We help you decide.
Why Is My JavaScript Not Working? (With Examples)
We round up the most common causes for your JavaScript code not working.
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.
Set an Attribute Without a Value in JavaScript (Tutorial)
The best ways to set an empty attribute to one or multiple DOM elements in your HTML markup, with plain JavaScript.
Remove Quotes From String in JavaScript
We look at the simplest, most straightforward way to remove quotes from a string in JavaScript.
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.
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.
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.
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.
Alphabet Array in JavaScript (Tutorial)
The simplest, most straightforward ways to create an array of letters in the English alphabet in JavaScript.
Find the Largest Number in an Array in JavaScript
The quick and easy way to find the largest number in an array in JavaScript.
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.
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.
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.
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?
Check If String Is Empty in JavaScript
Find out the two best ways to check whether a string is empty or not in JavaScript.