Something similar to this code returns a variable undefined error:
var firstVariable = "";
var secondVariable = "";
// later on...
secondVariable = firstVariable.length
alert("text text text " + secondVariable + " text text text.")
I need secondVariable to be globally defined and accept string pushes for other purposes, so changing that second line to
var secondVariable
doesn't seem to be a good option. But I'm not even sure whether the error is on line 2, line 4 or line 5. Can somebody help?