Blog

Insert, Remove, and Replace elements with Array.splice()

startup-593296_960_720

When you already have an existing array and need to make some edits, the Array.splice() method comes in handy. The splice() method allows you to INSERT, REMOVE, and REPLACE elements from a javascript array. Before jumping into any examples, let's start by taking a look at the arguments passed into the splice() method. Array.splice(start_index, number_of_elements_to_remove); start_index refers to the position in the array where the Insertion or Removal of elements will begin. number_of_elements_to_remove will begin at the start index, and remove X number of elements from the array all arguments following number_of_elements_to_remove will get inserted in to the array from the start_index. these arguments inserted into the array can be of any data type including strings, numbers, booleans, objects, functions, null, undefined, etc... For a more in depth look at the Array.prototype.splice() javascript method parameters check out https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice Let's start...

Read more

Learn JavaScript Basics (Free Course) Part 2/6: Basic Features

Variables Variables are a means for holding on to or pointing to… Read more

Learn JavaScript Basics (Free Course) Part 1/6: Overview and Setup

What is this Course? This course is intended to be a beginner’s… Read more

Unit conversion with javascript Array.map()

This tutorial will demonstrate how to convert units of measurement with the… Read more

JavaScript Redirect: How to Redirect a Web Page with JavaScript

You can redirect a web page to another page in a number… Read more

CSS !important Rule: How to Use It Correctly

The CSS !important rule approaches us like a fake savior angel in… Read more

5 Examples to Help You Understand How CSS Opacity Works

You can control the transparency of HTML elements on a web page… Read more

CSS Class vs ID: Which One to Use

In this post, we will take a brief look at how classes… Read more

Simple CSS z-index Tutorial for Beginners

In this tutorial, we will talk in detail about what CSS z-index… Read more

How to change CSS using jQuery?

The jQuery .css method is used to GET or SET DOM element CSS… Read more