./ Write the program for using JavaScript by using for loops (through a block of code a number of times), for/in - loops (through the properties of an object), while - loops (through a block of code while a specified condition is true), do/while - loops (through a block of code while a specified condition is true).

js

// check the console for output

<script>
    // for loop
    const students = ["yash", "ajay", "dev"]
    let output = ""
    for (let i = 0; i < students.length; i++) {
        output += students[i] + ' '
    }
    console.log('For Loop Output' + '\n' + output)

    // for/in loop
    output = ""
    for (let student in students) {
        output += students[student] + " ";
    }
    console.log('for/in Loop Output' + '\n' + output)

    // while loop
    output = ""
    let i = 0
    while (i < students.length) {
        output += students[i] + " ";
        i++;
    }
    console.log('While Loop Output' + '\n' + output)

    // do loop
    output = ""
    i = 0
    do {
        output += students[i] + " ";
        i++;
    }
    while (i < students.length);
    console.log('Do While Loop Output' + '\n' + output)
</script>