I was studying some jquery plugins and realized that to create the html, the programmer wrote each line in an array and finally used the 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('');
Someone with experience knows why to write that way, ie without using a string and concatenating each line?
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>';