What is for each...in a statement in JavaScript?

The for each...in loop iterates a variable overall value of the properties of objects. 

Note − The “for…each..in” is now deprecated. Do not use. 


Here’s the syntax −

for each (variablename in object) {
   statement or block to execute


Here’s an example, which will not run on any of the web browsers, since “for each..in” is now deprecated −

<!DOCTYPE html>
         var myObj = {myProp1:30, myProp2: 40};
         var sum = 0;
         for each (var value in myObj) {
            sum += value;