Menu

javascript

How to Use the Vibration API for Haptic Feedback in Mobile Web Applications
The JavaScript Vibration API is a powerful yet simple tool that allows developers to trigger vibrations on mobile devices directly through t
What are JavaScript Proxies and how they work
One of the most powerful, but not often seen or used, features of JavaScript are proxies. Proxies were introduced in ECMAScript 6 and they a
A Look at the Drag and Drop API in JavaScript
The HTML5 Drag and Drop API offers a simple method for allowing the movement of HTML objects around a webpage. In the past, this typically i
How to Generate GUIDs in JavaScript
Generating unique ID's is a common practice in most modern web applications. Whether you're building APIs, databases, or client-side applica
Web Storage API: LocalStorage vs. SessionStorage
When developing modern web applications, it’s common to store some data directly on the user's browser. Whether it’s user preferences, sessi
How to abort a fetch after 'n' seconds in JavaScript
When making a fetch request in JavaScript, there might be a scenario where you would want to cancel the request if it's taking too long. Thi
How to implement the Screen Wake Lock API in JavaScript
The Screen Wake Lock API allows web applications the ability to prevent the client device screen from locking or dimming after the
What does the JavaScript Temporal.PlainDate method do
One of the latest additions to the ECMAScript 2024 standard is the Temporal.PlainDate method which is a part of the Temporal API i
How to implement ROT13 in JavaScript
ROT13 is a specific implementation of the Caesar cipher that replaces each letter with the letter that is 13 places down the alphabet. For e
What is Bun, the new JavaScript runtime on the block
Bun is the ultra fast JavaScript runtime that has taken the internet by storm and that is set to dominate the JavaScript development market
How to Implement a Substitution Cipher in JavaScript
Cipher's are a good way to put your coding skills into practice. They are usually relatively simple to implement in terms of the amount of c
Should You Use a JavaScript Framework?
I've read far too many articles this week about why developers should avoid using JavaScript frameworks in lieu of plain old vanilla JavaScr
What is the best way to learn JavaScript?
JavaScript has quickly become one of the most widely used and popular programming languages of the past decade. Thanks in part to technologi
How to add character count to any textarea in JavaScript
If you are building a user entry form of any kind, you often times want to limit the number of characters that a user is allowed to enter in
How To Effectively Use 'async' and 'await' in JavaScript
Promise based asynchronous code in JavaScript has typically not been the easiest to write. Dealing with promise-chaining and nested callback
JavaScript Events: DOMContentLoaded vs load
Most programmers are familiar with the 'load' event listener in JavaScript.
How to render a file image preview in JavaScript
A pretty cool feature that you can add to your file upload elements, if you are working with images, is the ability to render a preview on t
3 tips when learning JavaScript
If you are looking to become a web developer at any point in time, then JavaScript is going to have to be your go to programming language. A
How to deep clone a JavaScript array
If you are looking to make an identical copy of an array in JavaScript, then using the default assignment operator will not do the trick as
Working with the destructuring assignment in JavaScript
The destructuring assignment in JavaScript is one of those things that you might never see yourself using, but that might be just the thing
How to add color and style to the console.log
The developer console in a browser is one of the most valuable tools for any web designer and web developer. Not only does it tell you what'
How to create console log groups in JavaScript
Most programmer's are familiar with a browser's built in debugging tools. This includes the standard Inspector used to view the DOM elements
How to drag elements in JavaScript without jQuery
In this article, we are going to implement the draggable functionality (found in jQuery) using vanilla JavaScript with just a few lines of c
How to implement infinite scrolling in JavaScript
Infinite scrolling is a popular technique that social media sites tend to use often, mainly on mobile devices, in which a user naturally scr
Implementing a Caesar Cipher in JavaScript
Cipher's are a great way to practice your logical coding skills. Plus, they're kind of fascinating. Ciphers have been used for hundreds, if
How to Ctrl + S to save in JavaScript
The Ctrl + s shortcut has become so natural as a saving mechanism, that I find myself doing it automatically many times with websites.
How use-strict affects your JavaScript code
You might be familiar with seeing the following directive at the top of JavaScript files.
How to implement a "Load More" button in JavaScript
Infinite loading, also referred to as infinite scrolling, is a popular UI/UX technique in which a user does not have to leave the page in or
How to validate email addresses in the browser and with JavaScript
Validating data is key to ensuring both a good user experience and for keeping your databases clean. And while the HTML standard has more re
Top 4 jQuery alternatives to consider switching to
jQuery is probably still the most popular and widely used JavaScript library out there today, and that's mainly due to its longevity. Latest
How to bind events in JavaScript to dynamic elements
Thanks in part to Ajax and front-end heavy frameworks like React and Angular, much of a website these days is generated in real-time dynamic
Is it still okay to use jQuery in 2020?
I get this question asked all of the time from my students. And my answer will typically be something like "Why is it wrong to use jQuery?".
Capitalize the first letter of any string in JavaScript
While there is no direct bulit-in function in JavaScript (yet) to capitalize the first letter of a string, there are various ways that you c
Creating a right-click contextual menu in JavaScript
Right click contextual menu's are a great way to hide menu items that are less commonly used, and that you want to keep out of sight until
How to stick an element to the page when scrolling
Keeing items on the page when scrolling downwards can be a beneficial feature when you have elements that ideally land somewhere near the to
How to use the developer console like a pro
The console window in a browsers developer tools is more than just a long list of red strings letting you know that something has gone wrong
Working with default function parameters in JavaScript
Default function parameters are a great addition to the JavaScript specification as of ES2015 that allows us to give a default starting value to named parameters in a function.
Working with Maps in ECMAScript 6
In my last post I went over the Set() data structure that was introduced with ECMAScript 6. Today I will be going over t
Working with Sets in JavaScript
ECMAScript 6 introduced the new Set type into its toolset. What are Set's? Essentially they are an ordered list of values that hav
What exactly is the JAM Stack?
If you are fan of JavaScript then you no doubt have encountered the term JAMStack at some point in your career. In this post I'm going to br
Checking if users are offline with navigator.onLine
"Must be online to continue". "You have been disconnected". "Error: Status code: YSLFJLFJSKDFJS"We have all seen that message appear at some
The simplest way to create dynamic modal pop-ups in JavaScript
Modal windows are an important UI/UX tool when it comes to pretty much any type of application, whether web, mobile or even your local ATM m
JavaScript Bubble Sort Algorithm Explained: A Beginner’s Guide
Sorting is a common task that is required of programmers many a time. You need to sort things such as search result sets to standard lists o
How to create a calculator in JavaScript
You may think you know what a calculator is. But it's not until you begin to code something that you get to see just how complex it can be.
Should you stop adding the 'type' attribute in your script tags?
The year is almost 2020 as of this writing, and the HTML5 specification officially became a stable W3C Recommendation in 2014. Is it now tim
How JavaScript optimizes tail calls
A commonly seen useful shorthand when writing code is the ability to call a function as a return statement.
Custom JavaScript pagination of objects
This is a follow up to my post How To Paginate Through A Collection In Javascript article. In this updated version I wi
Should you continue to use jQuery?
I get asked alot of questions about jQuery. And most are pretty valid for a curious mind learning to code. A few popular ones are the follow
Creating functions dynamically with JavaScript
The Function constructor is something that isn't usually talked about in JavaScript circles, but it is a useful mechanism to have
Working with JavaScript Tagged Template Literals
There is one feature in JavaScript (ES6) that many developers are totally unaware of and one that can be very beneficial in your p
Working with ES6 classes and objects
ES2015 introduced a new syntax into the JavaScript specification that finally allows us to create classes in a much cleaner way than th
Working with multiline strings in JavaScript
Today I am going to talk about a seemingly boring topic, strings in JavaScript. But stay with me, as we'll be going into some low-level
What does the future of JavaScript look like?
It wasn't that long ago that JavaScript was shunned in the coding community as a small-time scripting language used mainly to hide and show
How to copy to clipboard in JavaScript
Sure you can always just highlight text and then ctrl+c, but sometimes due to text constraints (large text) or just for ease of use to your
A quick look at prototypes in JavaScript
All JavaScript objects inherit properties and methods from a prototype. Prototypes are the mechanism by which JavaScript objects inherit fea
Mastering the interview: The Fibonacci Sequence in JavaScript
One of the most common questions that a developer will get asked during a live coding interview is to give an implementation of the Fib
How the Spread operator works in ES6
The Spread operator is one of those concepts in JavaScript that, while you appreciate what it does, you just can't ever quite seem to find t
How to use block bindings in ES6
For a long time now, declaring variables using the standard var keyword was commonplace in JavaScript. While super easy to use, it was not w
Useful JavaScript ES6 concepts to start using right now
If you have not kept up with the many changes that JavaScript has gone through during the past few years, then maybe now is the time to inco
Coding A Calendar In JavaScript: Part 2
The following is the follow up to the ever so popular Coding a Calendar in JavaScript, in which I created a calendar widget in JavaScript.
How to Create a Basic Text Editor In JavaScript: A Step by Step Tutorial
Creating a rich-text editor in JavaScript isn't as difficult as many may think it is and can give you the much needed control over your code
Taking a look at jQuery's performance
jQuery is a great JavaScript library for getting things done quickly without having to put too much thought into how you're going to be doi
What is the best way to check for an empty string in JavaScript
A student recently asked me what the best way to check for an empty string in JavaScript was. I answered in the best way that I knew how an
How to add sorting to any table in JavaScript
And you never thought that algorithm class from college was going to pay off. In this post I'll be going over how to add the ability to sor
A Quick Guide To JavaScript Touch Events
The JavaScript specification now supports touch event handling for interactions with mobile devices and tablets.
Building Tetris In JavaScript Part 2
Welcome to part 2 in this building Tetris tutorial. If you missed part 1, feel free to check it out here. In this second part, we'll be fin
How to Code a Tetris clone In JavaScript
Tetris is one of the first games that many of us played growing up. It's fun and challenging and playing a single level can take you from a
Google Maps and Markers 101
There is no better way to share a location than with a map and a marker on it. The universal indicator of map based location in this and ag
How To Code Blackjack Using JavaScript
Today I will be building a small BlackJack game in pure JavaScript in the hopes that you out there reading this can use it as a frame to
How To Create A Rain Effect Using Crafty.js
In this post I will cover how to create a rain effect using the JavaScript game engine, Crafty.js, for a 2D side-scroller type of game. If
Play My Classic Snake Game
On this rainy day in Los Angeles, stay home, drink too much coffee and enjoy a classic game from our teen years (maybe). I coded this sna
Drag And Drop Image Upload In JavaScript
File Uploads have yet to really catch up with the times and with technology. Many reasons for this. Security being a major one. It's an ope
Coding A Calendar In JavaScript
In this tutorial I will cover rendering a calendar onto a webpage with a few lines of JavaScript.
Modal Windows With Pure JavaScript
If you're reading this post, then you are familiar with the concept of modal windows. But just in case you aren't here's a quick recap. Mod
"Click To Enlarge" Script With Pure JavaScript
Click to enlarge is a common feature on many sites nowadays. And while it may seem like a trivial feature to add to your website, just try
Add Pagination To Any Table In JavaScript
Pagination is one of those things that everyone hates implementing on their websites, and that we avoid doing until the data size calls for it.
Taking A Look At the Battery API In JavaScript
Does your browser know your battery status? You bet it does. Let's talk about that. HTML5 keeps adding more and more features to its lin
Taking A Look At JavaScript's WebGL
Just recently a friend of mine showed me a game running on a web browser and it was an amazing experience. The game wasn't particularly ama
A Beginners Guide To JavaScript
JavaScript is a great language for anyone just starting to code for a variety of reasons. It's lightweight, runs fast and most importantly
Getting Started With JavaScript's WebRTC
WebRTC is a free open sourced technology that allows your everyday browsers to perform Real Time Communication through a set of simple API'
Building A Side Scroller With Crafty.JS
It's time to take what I've learned about Crafty.js in the past couple of weeks and to put it to use and build a side scroller game. Also,
How To: Make A Game With Crafty JS Part 3
This is a follow up to my last two Crafty.js posts which you can find in part 1 and part 2 in those links, which covered the basics of gett
How To: Make A Game Using Crafty JS Part 2
Welcome to part 2 of my Crafty.js How To. On the last post I started building a quick game that I made up using Crafty.js, a JavaScript-onl
How To: Make A Game Using Crafty JS Part 1
I recently went on a journey to find a good and simple to use 2D game engine, and after much reading, much installing, and much configurati
Coding A Card Deck In JavaScript
In this post, I will be going over how to build a deck of cards in JavaScript, that can be used for future projects or future games, such a
Coding The Snake Game In JavaScript
We've all seen the infamous snake game. It was a staple of non-smartphones back in the day. In this post, we'll be building something simil
Image and Text SlideShow In JavaScript
Last time I made a quick tic tac toe clone and today, at the request of a friend, I will make an image/text slideshow widget. We see them a
Step-by-Step Guide to Coding Tic Tac Toe in JavaScript
In this post we will be building the ever popular Tic Tac Toe game in JavaScript. It's a relatively simple implementation and the most comp
Getting Started With Node.JS On Windows
For a .NET developer I do sure spend alot of time working with JavaScript. And that's alright, variety is the spice of life. And so this we
'Secrets Of The Javascript Ninja' Review
I "know" JavaScript, the way that a new college graduate "knows" every programming language ever made. When I first graduated from college
Game Development And Prototyping In JavaScript
In my previous post I talked about why JavaScript is such a great language for newcomers to the programming world due to it's ability to ge
How To Paginate Through A Collection In JavaScript
Pagination is one of those annoying features that aren't fun to implement in any language, but that is pretty much essential for a good UI.
A 5 Minute Guide To Knockout JS
In the spirit of trying out new and interesting Javascript frameworks, and just new technologies in general, this week I take Knockout.js f
A Quick 5 Minute Guide To Angular JS
Angular.js is a fairly newcomer in the JavaScript framework world. It was first introduced in 2012 by a Google employee, and has since been...