virtual-labs-archive / computer-programming-responsive-iiith

This repository contains the responsive Computer Programming Lab IIITH
https://cse02-iiith.vlabs.ac.in
Other
1 stars 324 forks source link

Missing var declarations for loop variable #427

Open GaurangTandon opened 5 years ago

GaurangTandon commented 5 years ago

In advControlFlow.js

displayLoop: function(loopId, firstStatementId) {
    var node = document.getElementById(loopId);
    var allChild = node.childNodes;
    for(i = 1 ; i < allChild.length ; i+=2) 
    {
        if( allChild[i].id === firstStatementId)
            this.changeClass(allChild[i].id, "showDivInRed");
        else
            this.changeClass(allChild[i].id, "showDiv");    
    }
},

See line 4. Missing var declaration. Code may have side-effects with global variable named i, if it ever existed.

GaurangTandon commented 5 years ago

Fixed https://github.com/virtual-labs/computer-programming-responsive-iiith/pull/428/commits/7575757e6e0bc03c34565bb92d462bf66c3bf087

DevikaBoddu commented 5 years ago

Valid fix: @GaurangTandon