Posts tagged as "javascript"

Using Content Editable Elements in JavaScript (React)

Any element can be made editable with the addition of the attribute. This attribute is used all over the web, such as in Google Sheets. I…

Understanding Bits, Bytes, Bases, and Writing a Hex Dump in JavaScript (Node)

I was recently tasked with creating a simple command line program that would take an input of a file of unknown contents and print a hex…

Build a CRUD App in React with Hooks

In the latest release of React, a new concept was introduced - Hooks . Hooks are being added to React as an alternative to classes. If you…

Promise.all with Async/Await

Let's say I have an API call that returns all the users from a database and takes some amount of time to complete. Now there's another call…

Getting Started with React - An Overview and Walkthrough

I've been hearing about React since I first started learning JavaScript, but I'll admit I took one look at it and it scared me. I saw what…

How to Promisify an Ajax Call

Let's say you have an AJAX call, and some other function that depends on the AJAX call loading before it runs. Here's the AJAX function. And…

How to Upload Files to a Server with Plain JavaScript and PHP

Writing the code to upload images to a server from scratch seems like a very daunting task. I'm going to make a very simple upload form to…

ES6 Syntax and Feature Overview

ECMAScript 2015, also known as ES6, introduced many changes to JavaScript. Here is an overview of some of the most common features and…

How to Paginate an Array in JavaScript

I wanted to take an array of URLs in JavaScript and be able to paginate to the correct one by clicking on the previous and next buttons…

Basic Refactoring: Don't Repeat Yourself

Refactoring is the process of editing code to improve efficiency and readability without changing the output. I made a little example to…

Object Oriented Pattern: JavaScript Constructor Functions, ES6 Classes, and PHP Classes

I wrote an article on Understanding Prototypes and Inheritance in JavaScript for DigitalOcean, in which I explained how to use constructor…

Unit Testing in JavaScript with Mocha

Test-driven development (TDD) is an approach to development that consists of writing tests, followed by production code, and refactoring as…

How to Use the JavaScript Fetch API to Get JSON Data

In How to Use JSON Data with PHP or JavaScript , I discussed how to use to get data from a JSON feed. The Fetch API is a newer built-in…

How to Create a Memory Game (ala Super Mario 3) with Plain JavaScript

I was presented with a coding exercise to make a memory game using any language. I decided such a task really doesn't require any libraries…

How to Use Local Storage with JavaScript

I like making tutorials where you build a small application completely from scratch with plain JavaScript. A to-do list is a common app idea…

How to Connect to an API with JavaScript

A big part of working with JavaScript is knowing how to connect to APIs. As a fledgling developer, you may have been told at some point to…

Real World Examples of Map, Filter and Reduce in JavaScript

I don't know about you, but it doesn't help me very much to peruse through endless examples of and to try to figure out how to use a…

How to Install and Use Node.js and npm (Mac, Windows, Linux)

In order to use almost any development tools based in JavaScript, you'll need to know how to use npm and Node.js. Gulp , Grunt , and…

Smooth Scroll to ID with jQuery

Here's a quick snippet of jQuery code I use often when I need to smoothly scroll to an ID. Just change the to whatever speed (in…

Simple jQuery Examples with Code and Demos

Recently, I wrote a beginner's guide to using and understanding jQuery for Digital Ocean . I found the official jQuery documentation…

How to Use jQuery, a JavaScript Library

Introduction HTML, CSS, and JavaScript are the three fundamental languages of the web. We structure our websites with HTML, style them with…

How to Use JSON Data with PHP or JavaScript

JSON is used to transmit data between a server and a browser. Here is a basic example of what might be in a string. As you can see, it's…

Google Maps APIs for Multiple Locations

I was working on making a locations page for a multi-location restaurant concept. The overwhelming trend currently is to include a Google…