JavaScript example #2

PHOTO EMBED

Fri Dec 18 2020 05:49:50 GMT+0000 (UTC)

Saved by @Javkhlantugs ##javascript

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <script>
        
        //var arr = ['1', '2', '3', '4', '5']; 

        //for (var i = 0; i < arr.length; i++)
        //{
        //    document.write(arr[i] + '<br/>'); 
        //}

        //while (i < arr.length) {
        //    document.write(arr[i] + "<br/>")
        //i++; 
        //}

        //var x;
        //for (x in arr) {
        //    document.write(arr[x] + "<br/>"); 
        //}



        //for (var i = 0; i < 5; i++) {
        //    var s = Console.ReadLine(); 
        //    s = 


        //}

        //var num = [1, 2, 3, 4, 5];
        //var total = 0; 

        //for (var n in num) {
        //    total += MyNums[n];
        //}
        //document.write(total)
        //document.write(total / arr.length)); 

        var num = [];
        var total = 0; 
        for (var i = 0; i < 5; i++) {
            num[1] = Number(prompt('Enter a number'));
            document.write(num[i] + ' ');
            total += num[i];
        }
        document.write('<br/>Total: ' + total + '<br/>');
        document.write('Average: ' + (total / num.length) + '<br/>'); 

         

    </script>

</body>
</html>
content_copyCOPY