JavaScript


Node Package Manager, or npm, is npm makes it easy for JavaScript developers to share the code that they’ve created to solve particular problems, and for other developers to reuse that code in their own applications. Once you’re depending on this code from other developers, npm makes it easy to […]

Node Package Manager (npm)



Grunt is a JavaScript task runner. As the website https://gruntjs.com/ says: “In one word: automation. The less work you have to do when performing repetitive tasks like minification, compilation, unit testing, linting, etc, the easier your job becomes. After you’ve configured it through a Gruntfile, a task runner can do […]

Grunt Introduction




In JavaScript, the Unshift array method adds new items to the beginning of an array and returns the new length. This method changes the length of an array. Here is some sample code from w3schools.com Unshift Objects Here is a screenshot of the console output in Google Chrome browser.

JavaScript Arrays unshift


The findIndex() method returns the index of the first element in an array that passes a test (provided as a function). The findIndex() method executes the function once for each element present in the array: If it finds an array element where the function returns a true value, findIndex() returns […]

JavaScript Arrays findIndex



The JavaScript array find() method gets the first element of the array that has a specified value. Below is some modified sample code from w3schols.com. The find() method returns the value of the first element in an array that pass a test (provided as a function). The find() method executes […]

JavaScript Arrays find






Adding Array Elements You can add elements to an array with the JavaScript array push() method. The push() method adds new items to the end of an array, and returns the new length. To add items at the beginning of an array, use the unshift() method. To remove the last […]

JavaScript Arrays push


Random Numbers You use the Math.Random() function to generate a number between 0 (inclusive) and 1 (exclusive). You can multiply the result by 7, for example, to get a number between 0 (inclusive) and 7 (exclusive) and then use the Math.Floor() function to remove anything to the right of the […]

JavaScript Random Numbers



The code below demonstrates the forEach() method on a JavaScript array using a modified example from w3schools.com. The forEach() method calls a provided function once for each element in an array, in order. forEach() does not execute the function for array elements without values. Here is the output in the […]

JavaScript Array forEach() method