Category: Raw Javascript

Filtering and Chaining in Functional JavaScript

One of the things I appreciate about JavaScript is its versatility. JavaScript gives you the opportunity to use object oriented programming, imperative programming, and even functional programming. And you can go back and forth among them depending on your current needs and the preferences and expectations of your team...

Editorial: What Do You Want to Learn in 2017?

This is the editorial from our latest JavaScript newsletter, you can subscribe here. Hey everyone, welcome to a brand new year on SitePoint JavaScript. I hope you had a great break (for those of you that took one) and are ready to start off 2017 with a bang. 2016 was a crazy year for JavaScript! We saw an ever increasi...

Native JavaScript Development after Internet Explorer

Welcome everyone to the third and last part of this series, dedicated to the retirement of oldIE and the changes this event has in the field of front-end development. So far we covered the obsolete techniques that can be safely discarded and the HTML5 and CSS3 properties that now have full native support along the mai...

Web Audio API: Add Bandwidth-Friendly Sound to Your Web Page

The Web Audio API allows developers to leverage powerful audio processing techniques in the browser using JavaScript, without the need for plugins. As well as defining and processing file-based audio sources in real-time, it can synthesize sounds based upon various waveforms; this can be useful for web apps that are of...

Quick Tip: Replace jQuery’s Ready() with Plain JavaScript

The ready method was implemented in jQuery to execute code when the DOM is fully loaded. Since it executes the given function when all DOM elements are available, you can be sure that trying to access or manipulate elements will work. Before jQuery 3.0, the typical usage with a anonymous function looked like this: $(do...

Building a JavaScript 3D Minecraft Editor

I’ve always wanted to build a 3D game. I’ve just never had the time and energy to learn the intricacies of 3D programming. Then I discovered I didn’t need to… While tinkering one day, I got to thinking that maybe I could simulate a 3D environment using CSS transformations. I stumbled across an o...

Quick Tip: How to Style Google Custom Search Manually

Website owners very often decide on using Google’s Custom Search Engine (GCSE) for searching through their content instead of using built-in and/or custom search functionality. The reason is simple – it’s much less work, and most often it does the trick. If you don’t need advanced filters or cus...

Saved from Callback Hell

Callback hell is real. Often developers see callbacks as pure evil, even to the point of avoiding them. JavaScriptʼs flexibility does not help at all with this. From the surface, it seems callbacks are the perfect foot gun, so it is best to replace them. The good news is there are simple steps to get saved from callba...

Quick Tip: Add or Remove a CSS Class with Vanilla JavaScript

Sometimes you need to add or remove a CSS class with JavaScript, and you don’t want to include an entire library like jQuery to do it. This is useful in situations when you want your page elements to change in response to user actions. Example uses include:Showing or hiding a menu Highlighting a form error Sh...

Quick Tip: How to Declare Variables in Javascript

When learning JavaScript one of the basics is to understand how to use variables. Variables are containers for values of all possible types, e.g. number, string or array (see data types). Every variable gets a name that can later be used inside your application (e.g. to read its value). In this quick tip you’ll l...