Blog

python tutorials and learn python

Created with Sketch.

JavaScript Array forEach: Executing a Function on Every Element

JavaScript Array forEach: Executing a Function on Every Element Summary: in this tutorial, you will learn how to use the JavaScript Array forEach() method to exeucte a function on every element in an array. Introduction to JavaScript Array forEach() method Typically, when you want to execute a function on every element of an array, you use…
Read more

JavaScript Array sort: Sorting Array Elements

JavaScript Array sort: Sorting Array Elements Summary: in this tutorial, you will learn how to use the JavaScript Array sort() method to sort arrays of numbers, string, and objects. Introduction to JavaScript Array sort() method The sort() method allows you to sort elements of an array in place. Besides returning the sorted array, the sort() method…
Read more

JavaScript Array some: Check If at Least one Array Element Passes a Test

JavaScript Array some: Check If at Least one Array Element Passes a Test Summary: in this tutorial, you will learn how to use the JavaScript Array some() method to check if at least one element in the array passes a test. Introduction to the JavaScript Array some() method Sometimes, you want to check if an…
Read more

JavaScript Array every: Determining If All Array Elements Pass a Test

JavaScript Array every: Determining If All Array Elements Pass a Test Summary: in this tutorial, you will learn how to check whether all the array elements pass a test using the JavaScript Array every() method. Checking array elements using the for loop Sometimes, you need to test whether every element of an array satisfies a specified…
Read more

JavaScript Array reduce & reduceRight: Reducing an Array Into a Value

JavaScript Array reduce & reduceRight: Reducing an Array Into a Value Summary: in this tutorial, you will learn how to use the JavaScript Array reduce() and reduceRight() methods to reduce an array to a value. Introduction to the JavaScript Array reduce() method Suppose that you have an array of numbers, like this: let numbers =…
Read more

JavaScript Array filter: Filtering Elements

JavaScript Array filter: Filtering Elements Summary: in this tutorial, you will learn how to use the JavaScript Array filter() method to filter elements in an array. Introduction to JavaScript array filter() method One of the most common tasks when working with an array is to create a new array that contains a subset of elements…
Read more

JavaScript Array map: Transforming Elements

JavaScript Array map: Transforming Elements Summary: in this tutorial, you will learn how to use the JavaScript Array map() method to transform elements in an array. Introduction to JavaScript Array map() method Sometimes, you need to take an array, transform its elements, and include the results in a new array. Typically, you use a for…
Read more

JavaScript Array findIndex() Method

JavaScript Array findIndex() Method Summary: in this tutorial, you will learn how to use the Array findIndex() method to find the first element that satisfies a given test. Introduction to the JavaScript Array findIndex() Method ES6 added a new method called findIndex() to the Array.prototype, which allows you to find the first element in an…
Read more

JavaScript Array find() Method

JavaScript Array find() Method Summary: in this tutorial, you will learn how to use the JavaScript find() method to search for the first element in an array, which satisfies a test. Introduction to the Array find() method In ES5, to find an element in an array, you use the indexOf() or lastIndexOf() methods. However, these…
Read more

JavaScript Array includes: Check If an Element is in the Array

JavaScript Array includes: Check If an Element is in the Array Summary: this tutorial introduces you the JavaScript Array includes() method that checks if an element is in an array. Introduction to the JavaScript Array includes() method When working with an array, you often want to check if the array contains an element. To do…
Read more