Hello,
I am having an issue with some DOM code.
The code exists within an object and is called by an ajax callback, but I don't think that is my issue, but I could be wrong, it has happened before 
The below code generates the following error on the FireFox Console: "TypeError : reviewDiv is undefined".
Then it still goes ahead and correctly prints "individualReviewDiv" which is generated by
console.log(reviewIndex);
I know the code does not make sense but it is to debug the issue.
Please advise as I am relatively new to web development and am at a stand still. Any help is appreciated.
reviewChildren = mySelf.parentDiv.querySelectorAll(".individualReviewDiv");
console.log(reviewChildren.length + " reviews");
for (var i=0; reviewChildren.length; i++) {
var reviewDiv = reviewChildren[i];
reviewIndex = reviewDiv.getAttribute("class"); //<----error on this line
console.log(reviewIndex);
}