Tag: javascript

Count the number of times a substring appears in a string in JavaScript
15 Jan 2021
Have you ever tried to see how many times a letter or a word appears in a string? Or how many tim...
Convert an array of numbers to an array of ordinal numbers in JS
14 Jan 2021
To format an array of numbers as ordinal numbers, we need to properly add the suffixes -st, -nd, ...
Format a number as currency in JS
13 Jan 2021
Formatting a number as currency in JS is easy. We can use Intl.NumberFormat(), and style it as cu...
Format a number with comma as a thousands separator in JS
12 Jan 2021
In JS, we can add a comma as thousands separator using the toLocaleString() method, or using Intl...
Generate a random sub-array from a larger array
11 Jan 2021
To get a random, three-member sub-array from an array of items, we need to use the splice, Math.r...
Add random CSS classes to a paragraph in JavaScript
10 Jan 2021
We have a web page with a script tag. That script tag holds an array of various Bootstrap 4 CSS c...
Generate a random password with JavaScript
09 Jan 2021
We can easily whip up our own password generator in vanilla JS. This tutorial shows you how to do...
Randomize the order of members in a JavaScript array
08 Jan 2021
Randomly reordering members of a JavaScript array might seem an easy task, but it can also be dif...
Get a number randomly from a range of numbers in JS
07 Jan 2021
Math.random() gives us a range between 0 (inclusive) and 1 (exclusive). But how do we use this me...
Randomly return a true or false from a JavaScript function
07 Jan 2021
Using the conditional (ternary) operator, we are able to easily return, at random, either a boole...
Pick a random member from a JavaScript array
06 Jan 2021
Multiply the length of array with the call to Math object's random method, then floor the result....
Emulate a six-sided dice
05 Jan 2021
Use Math.random() static method to emulate a pair of dice in JavaScript, and keep in mind these s...
Node types in the DOM
12 Dec 2020
There are 12 node types in the DOM. It's useful to know at least the few of those that are most c...
Objects vs non-objects in JavaScript
12 Dec 2020
This article discusses the difference between objects and non-objects in the JavaScript language.
Working with onload events in vanilla JS
28 Nov 2020
Understanding how onload event works in the DOM with vanilla JS is a very important piece of know...
Replace all instances of a CSS class using vanilla JS
07 Mar 2020
How to use vanilla JavaScript to replace all instances of a CSS class with another CSS class on a...
The Ultimate List of Productivity Boosters for Developers
05 Dec 2019
Productivity can be hard to improve, even if you're a talented web developer. Here's a list of ti...
Multiplication table using nested for loops
03 Dec 2019
Nested for loops in JavaScript can help us with a number of coding tasks. In this article, we'll ...
Working with maps in JavaScript
02 Dec 2019
The map data structure is another data structure in JS that derives from the Object prototype. In...
Working with arrays in JavaScript
02 Dec 2019
JS array prototype, array methods, array use cases, and a number of tips and tricks - we're going...
Working with sets in JavaScript
01 Dec 2019
This is an in-depth introduction to sets in JavaScript. A set is a special kind of a collection i...
Practicing JavaScript by playing with SVGs on YouTube web app
27 Nov 2019
DOM manipulation, working with SVGs and JavaScript events - we cover all of that in this beginner...
Dynamically change styles using JavaScript
24 Nov 2019
In this tutorial, we'll work with events to change the background color of an element dynamically...
Write a simple quiz app in JavaScript
10 Nov 2019
How to write a very simple quiz app in JavaScript? Find out in this introductory, beginner-friend...
Write a simple todo app in JavaScript
10 Nov 2019
How to write a very simple todo app in vanilla JavaScript? Find out in this introductory, beginne...
Helpful tricks to learn JavaScript
08 Nov 2019
What are the ways to improve you JavaScript coding skills? How to get better faster? Are there an...
What are events in JavaScript
08 Nov 2019
JavaScript inline event handlers, event propagation, event bubbling and capturing, the Event obje...
Filter Google search results with JavaScript
08 Nov 2019
The ability to use JavaScript right in the browser, via the devtools console, opens up a world of...
Useful JavaScript snippets
03 Nov 2019
This article lists a number of various snippets, tips, and tricks in JavaScript. This is an open-...
Objects in JavaScript in Depth
21 Oct 2019
Learn all about objects in JavaScript in this in-depth tutorial on the topic.
The Anatomy of a JavaScript function, part 5
20 Oct 2019
There are well over a dozen ways to define a function in JavaScript. In this fifth article of the...
The Anatomy of a JavaScript function, part 4
20 Oct 2019
How to use the function arguments and how are they related to the ES6 speread operator? This is t...
The Anatomy of a JavaScript function, part 3
19 Oct 2019
What are the differences between ES5 and ES6 functions? We answer this question in this article, ...
The Anatomy of a JavaScript function, part 2
18 Oct 2019
How to generalize functions in JavaScript? Learn all about it in this second part of the Anatomy ...
Should I first learn vanilla JavaScript or Angular?
08 Oct 2019
It's hard to choose what to learn in web development when there are so many options: should I lea...
Understanding Node, npm, JavaScript modules, and webpack
25 Sep 2019
Why Node and npm? What’s up with Grunt, Gulp, and Webpack? Why choose one over the other? How to ...
Learning JavaScript basics by coding tiny apps, part 2
09 Sep 2019
When you're learning to code, it's always a good idea to try to build apps on your own. These app...
Learning JavaScript basics by coding tiny apps
08 Sep 2019
When you're learning to code, it's always a good idea to try to build apps on your own. These app...
Merge two arrays using values of nested object in one of the two arrays
24 Mar 2019
Array fun ahead! How to merge two complex array into a single one? This is a practical exercises ...
10 Reasons to Choose JavaScript As Your First Coding Language
18 Mar 2019
If you're planning to start learning a coding language, you can't go wrong with JavaScript. In th...
The anatomy of a JavaScript function, part 1
03 Dec 2018
This tutorial compares JS functions to simple machines. We go step by step, building a JS functio...
Table border css
19 Oct 2018
In this quick tip tutorial, we see how easy it is to add a border to a table HTML element using C...