Open Console Log to See Functions at Work

Traditional For Loop

                let tools = ['Drill', 'Impact', 'Pliers', 'Wrench', 'Ratchet']

                for (let i=0; i < tools.length; i++) {
                    console.log(tools[i]);
                }
            

For Each Loop

                tools.forEach(function(tool) {
                console.log(tool);
                });
            

While Loop

                function whileLoop() {
                    console.clear();
                    console.log('While Loop Example:');
                    let i = 0;
                    while (i < tools.length) {
                        console.log(tools[i]);
                        i++;
                    }
                }
            

Do While Loop

                function doWhile() {
                    console.clear();
                    console.log('Do While Loop Example:');
                    let i = 0;
                    do {
                        console.log(tools[i]);
                        i++;
                    } while ( i < tools.length);
                }
            

Map Function

                function exampleMapLoop() {
                    console.clear();
                    console.log("Example 6: map() method");
                    let milwaukeeTools = tools.map(function(tools) {
                        return 'milwaukee ' + tools;
                    });
                    console.log(milwaukeeTools);
                }