Home » Search results for 'javascript array'

How to Remove Duplicates From an Array in JavaScript [Examples]

Javascript Remove Duplicates from Array

Being able to remove duplicates from (or de-duplicate) an array is a useful thing to be able to do. Here’s how it’s done. What is an Array? In programming, an array is a type of variable that can hold other values, or references to other variables, in a list at a certain position. Arrays are vital to building any application – allowing you to store a list of variables or values of any length in a single variable – ready to be iterated over, processed, … Read more

Home » Search results for 'javascript array'

How to Filter Arrays in JavaScript, With Examples

Javascript: filter arrays

We’ve covered arrays in JavaScript pretty extensively on LinuxScrew. This article will show you how to use the filter method – with easy-to-follow examples. JavaScript Arrays Arrays are a type of variable that holds a list of other values or variables. They’re one of the fundamentals of computer programming. These lists contain items at positions (called indexes). These items can be anything – numbers, strings, complex objects – whatever you want to store. Arrays are super useful. You might use them to store the rows in a … Read more

Home » Search results for 'javascript array'

How to Get the Length of an Array in JavaScript [Examples]

JavaScript Array Length

This article will show you how to get the length of an array in JavaScript, as well as provide some code examples. JavaScript is one of the most popular programming languages. From humble origins as a webpage scripting language for animating menus and displaying pop-up ads, it is now a full-blown ecosystem that you can use to build cross-platform mobile apps, web pages, server processes, and even games. JavaScript Arrays Arrays are a vital building block for any program, even simple ones. An array is a … Read more

Home » Search results for 'javascript array'

How To Compare Arrays in JavaScript, With Examples

Compare Arrays in JavaScript

This article will show you how to compare arrays in JavaScript and provides some ready-to-use functions to do so. We’ve already covered a bit on how to use arrays in JavaScript: Looping over Array using JavaScript forEach(), With Examples Array slice() Method in JavaScript, with Examples() Check Array Contains a Value in JavaScript, with Examples Removing an Element From an Array in JavaScript, with Examples What is an Array? An array is a type of JavaScript variable that can hold other variables, or references to … Read more

Home » Search results for 'javascript array'

Looping over Array using JavaScript forEach(), With Examples

JavaScript foreach

This article will show you how to use the JavaScript forEach() method to loop over an array. Pretty much any application of any complexity will require the looping over arrays (lists) of data. The JavaScript forEach() method, which is built into JavaScript array variables, does just this. You’ll be using it a lot – so thankfully, it’s pretty darn easy to use. JavaScript forEach() Syntax arr.forEach(callback(currentValue[, index[, array]]) { // execute something }[, thisArg]); Note that: arr is an array or a variable containing an array callback is the … Read more

Home » Search results for 'javascript array'

Array slice() Method in JavaScript, with Examples

Array slice in JavaScript

We have covered removing items from arrays in JavaScript, as well as checking whether an item is present in an array. This article will look at copying or returning a subsection of arrays using the slice() method in Javascript. slice() Syntax arr.slice([start[, end]]) Where: arr is an array or existing array variable start is the index to start the slice at If it is undefined, it will default to 0 The index is the position of the item within the array. Remember, they start at 0! end is the index to end the slice at If it … Read more

Home » Search results for 'javascript array'

Check Array Contains a Value in JavaScript, with Examples

Determining Whether an Array Contains a Value

This tutorial will show you how to check whether an array contains a specific value in Javascript, with full examples. JavaScript is a flexible programming language that runs just about everywhere. You can run JavaScript apps in web browsers, build command-line apps you can run in the terminal, mobile apps can be built using platforms like Cordova, and server processes can be written on platforms like Node.js. Naturally, Linux is the environment of choice for many JavaScript developers and is perfect for learning tools like … Read more

Home » Search results for 'javascript array'

Removing an Element From an Array in JavaScript, with Examples

Removing an Element From an Array in JavaScript

There are multiple ways to remove an element from an array in Javascript. We cover all of the methods that can be used in this tutorial. JavaScript is a flexible programming language that runs just about everywhere. You can run JavaScript apps in web browsers, build command-line apps you can run in the terminal, mobile apps can be built using platforms like Cordova, and server processes can be written on platforms like Node.js. Naturally, Linux is the environment of choice for many JavaScript developers and … Read more

Home » Search results for 'javascript array'

JavaScript Reference: Complete List of Operators + Examples

JavaScript Operators

This article will explain and list JavaScript operators and expressions. JavaScript operators perform a given operation on the provided expressions or values. Common operations include comparisons, arithmetic, and ternary operations. You will use JavaScript operators frequently (even the simplest JavaScript code will use multiple operators!), so it’s worth getting to know them, and their expected behaviour. What are Operators and Operands? Javascript operators perform a given operation, for example addition, subtraction, and other arithmetic, comparisons like greater than/less than, and more complicated operations like ternary/comparison … Read more

Home » Search results for 'javascript array'

Checking for Equality (And Inequality) in JavaScript, with Examples

Equality and Inequality JavaScript

This article will explain equality and inequality in the JavaScript Programming language, and provide code examples showing how to check if values are equal in value and type. Checking whether two values are equal can get a bit confusing in JavaScript – there is loose equality and strict equality involving types to consider. Read on to find out how testing for equality and inequality works in JavaScript. What are equality and inequality? In programming, equality is the process of checking whether two values are equal … Read more