toLowerCase() returning undefined
<p>I'm with an weird problem here.
I have a code like this:</p>

<pre><code>for (var j = events.length - 1; j &gt;= 0; j--) {
    var evtName = events[j].name.toLowerCase();
    //Do something um evtName
}
</code></pre>

<p>The <code>events</code> is an array with JSON objects. </p>

<p>The problem is that sometimes the evtName is set as undefined and I don't know why. I tried to put <code>console.log(events[j].name + ' - ' + evtName);</code> and the output is:</p>

<pre><code>ENSAIO ABERTO - undefined
PERCUSSÃO TRADICIONAL PORTUGUESA - undefined 
VIAGEM À MÚSICA ANTIGA[CONCERTOS PARA TODOS] - undefined
A MÚSICA TOMA CONTA DE MIM - undefined
NOVIDADES SINFÓNICAS - undefined
OPTIMUS CLUBBING | THE PAINS OF BEING PURE AT HEART | SEBASTIAN DJ - undefined
ENSAIO ABERTO - undefined
DE GOUNOD A RAVEL - undefined 
ORQUESTRA SINFÓNICA DA ESMAE - undefined 
MÚSICA DE BOLSO[WORKSHOPS PRIMEIROS SONS] - undefined 
MISSÃO EM-POSSÍVEL [MÚSICA EM FAMÍLIA] - missão em-possível [música em família]
ENSAIO ABERTO - ensaio aberto 
CRIOLO - criolo 
OPTIMUS CLUBBING | SUPERNADA | THE MAGICIAN | JORI HULKKONEN - optimus clubbing |    supernada | the magician | jori hulkkonen 
</code></pre>

<p>And I know that the problem is at the atribution <code>var evtName = events[j].name.toLowerCase();</code> because if I put <code>console.log(events[j].name + ' - ' + events[j].name.toLowerCase());</code> the string is corrected 'lower cased'. </p>

<p>I tried to put <code>toString()</code> in the atribution, didn't work too. </p>

<p>I need to have it in a variable because I need to format it more (like put the initial letters in capital, etc).</p>

<p>Any help? Thanks in advance</p>

<p>Found it. It was a missing '{'. The console didn't alert it though... Im really sorry for taking your time guys, thanks for all who helped</p>
