Estava estudando alguns plugins jquery e percebi que para criar o html, o programador escreveu cada linha em um array e ao final usou o join:
var tpl = [
'<div class="popover clockpicker-popover">',
'<div class="arrow"></div>',
'<div class="popover-title">',
'<span class="clockpicker-span-hours text-primary"></span>',
' : ',
'<span class="clockpicker-span-minutes"></span>',
'<span class="clockpicker-span-am-pm"></span>',
'</div>',
'<div class="popover-content">',
'<div class="clockpicker-plate">',
'<div class="clockpicker-canvas"></div>',
'<div class="clockpicker-dial clockpicker-hours"></div>',
'<div class="clockpicker-dial clockpicker-minutes clockpicker-dial-out"></div>',
'</div>',
'<span class="clockpicker-am-pm-block">',
'</span>',
'</div>',
'</div>'
].join('');
Alguém, com experiência, sabe porque escrever dessa forma, ou seja, sem usar uma string e concatenar cada linha?
var tpl = '<div class="popover clockpicker-popover">'+
'<div class="arrow"></div>'+
'<div class="popover-title">'+
'<span class="clockpicker-span-hours text-primary"></span>'+
' : '+
'<span class="clockpicker-span-minutes"></span>'+
'<span class="clockpicker-span-am-pm"></span>'+
'</div>'+
'<div class="popover-content">'+
'<div class="clockpicker-plate">'+
'<div class="clockpicker-canvas"></div>'+
'<div class="clockpicker-dial clockpicker-hours"></div>'+
'<div class="clockpicker-dial clockpicker-minutes clockpicker-dial-out"></div>'+
'</div>'+
'<span class="clockpicker-am-pm-block">'+
'</span>'+
'</div>'+
'</div>';