diff --git a/guide/english/javascript/loops/for-in-loop/index.md b/guide/english/javascript/loops/for-in-loop/index.md index 9ababf0683..6a54ba6802 100644 --- a/guide/english/javascript/loops/for-in-loop/index.md +++ b/guide/english/javascript/loops/for-in-loop/index.md @@ -18,14 +18,15 @@ for (variable in object) { ## Examples ```js // Initialize object. -var a = { "a": "Athens", "b": "Belgrade", "c": "Cairo" }; +const a = { "a": "Athens", "b": "Belgrade", "c": "Cairo" }; // Iterate over the properties. -var s = ""; -for (var key in a) { - s += key + ": " + a[key]; - s += "
"; +let s = ""; +for (let key in a) { + s += key + ": " + a[key]; + s += "
"; } + document.write (s); // Output: @@ -34,15 +35,15 @@ document.write (s); // c: Cairo // Initialize the array. -var arr = new Array("zero", "one", "two"); +let arr = new Array("zero", "one", "two"); // Add a few expando properties to the array. arr["orange"] = "fruit"; arr["carrot"] = "vegetable"; // Iterate over the properties and elements. -var s = ""; -for (var key in arr) { +let s = ""; +for (let key in arr) { s += key + ": " + arr[key]; s += "
"; }