Can anyone tell me why this else if statement is not working? I have displayed both on the page to check their values after being processed, and they are indeed the same. However, it doesn't work and I'm guessing it must be something with how I am comparing it. My code is below:

Code JavaScript:
<script id="template-download" type="text/x-tmpl">
	function test(arg){
		output = arg;
		{% for (var i=0, file; file=o.files[i]; i++) { %}
			<tr class="template-download fade">
				{% if (file.error) { %}
					<td class="name"><span>{}</span></td>
					<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
					<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
          // This is where I am having problems. I specify index zero and sooner or
         // later should match, but it never does and I'm not sure why??
        // So then I do else if ( "5.jpg" == ) and it does work....As you can
       // see that I test it in the line right below the else if, and displays the same as
				{% } else if ( output[0] == ) { %}
						<td class="name">{%=String(output[0])%}{%=String(}</td>
						<td class="preview">{% if (file.thumbnail_url) { %}
							<a href="{%=file.url%}" title="{}" rel="gallery" download="{}"><img src="{%=file.thumbnail_url%}"></a>
						{% } %}</td>
						<td class="name">
							<a href="{%=file.url%}" title="{}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{}">{}</a>
						<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
						<td colspan="2"></td>
					{% } %}
						<td class="delete">
							<button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
							<i class="icon-trash icon-white"></i>
							<input type="checkbox" name="delete" value="1">
		{% } %}

Any ideas? Thanks in advance!!!