How-to articles, tricks, and solutions about LOOP

How to Check if JavaScript Object is Empty

Read this tutorial and find methods of checking whether a JavaScript object is empty or not. Choose the best one for you and get the code immediately.

How to Compare Two JavaScrpt Arrays

You can either loop through the arrays or convert them to string and then compare. This tutorial provides several fast methods of comparing two arrays.

How to Copy Array Items into Another Array

Read this JavaScript tutorial and learn several useful methods of copying array items into another array. Get to know which method to choose for your case.

How to Count the Number if Keys/Properties of a JavaScript object

It is frequently necessary to count the number of keys/properties of an object in JavaScript. Find several solutions to that issue in this short tutorial.

How to Determine the First and Last Iteration in a Foreach loop?

In this snippet, we are going to figure out how to successfully determine the first and last iteration in a foreach loop with the help of PHP.

How to Find the foreach Index with PHP

Here is a short tutorial where you can find three helpful methods allowing to find the foreach index with the help of PHP.

How to Find the Min/Max Elements in an Array in JavaScript

Read this JavaScript tutorial and learn about the methods used to find the minimum and maximum number of elements in an array. Find the fastest solution.

How to Get All Property Values of a JavaScript Object

Read this tutorial and learn about several methods used for detecting the property values of an object without knowing the key based on specifications.

How to Get the First Key Name of a JavaScript Object

Read this JavaScript tutorial and learn about two methods of getting the first key name of an object. Get one-liner codes and make your work done properly.

How to Get the Index of an Array that Contains Objects in JavaScript

Read this JavaScript tutorial and learn several useful, fast and simple methods that are used for getting the index of an array that contains objects.

How to Get the Value of Text Input Field Using JavaScript

Read this tutorial and learn about several methods of getting the value of the input textbox value without wrapping the input element inside a form element.

How to List the Properties of a JavaScript Object

Read this tutorial and learn useful information about the two popular built-in methods that are used for listing the properties of the object in JavaScript.

How to Loop through an Array in JavaScript

The most common ways to loop through an array in JavaScript are the for, for/in and while loops. See how to use them. Examples.

How to Loop Through Array and Remove Items Without Breaking the For Loop

Read this JavaScript tutorial and learn some useful information about the method of looping through an Array and removing items without breaking for loop.

How to Loop Through or Enumerate a JavaScript Object

Read this tutorial and learn several useful methods of looping through or enumerate a JavaScript object. Try and copy the piece of the code right away.

How to Measure Script Execution Time in PHP

In this snippet, we demonstrate the simplest way of measuring the execution time of a string in PHP. Read on and check out the examples.

How to Separate Odd and Even Elements from an Array Without Using a Loop in PHP

Here, we provide a snippet, explaining how to separate odd and even elements from an array without using a loop in PHP. Read on and check out the examples.

How to Split Array into Chunks

Read the tutorial and find several easy and fast approaches to splitting a JavaScript array into smaller chunks. Choose one of the methods and try examples.

How to Use Continue and Break in PHP

The continue and break keywords are used to control the whole program flow. This snippet will show you examples of how to use these keywords in PHP.