Skip to content Skip to sidebar Skip to footer

Variable Used Out Of Scope

I'm doing a responsive background video. I have this code.

Solution 1:

You should not write var scale = heightScaleFactor; inside the else statement if you want to use it outside of it.

Initialize scale outside the if

var scale;
 if (widthScaleFactor >= heightScaleFactor) {
     scale = widthScaleFactor;
 } else {
     scale = heightScaleFactor;
 }

Post a Comment for "Variable Used Out Of Scope"