JSFiddle - React, Tailwind, and code Playground

HTML

<a href="http://programmers.stackexchange.com/questions/82593/javascript-ternary-operator-vs">http://programmers.stackexchange.com/questions/82593/javascript-ternary-operator-vs</a>
<hr />
<div id="box"></dv>

JavaScript

var 
    s='',text = "test".split(''), x = document.querySelector('#box'), code = [
function () { 
    // bad, but works
    s += text[i] || '.'; 
},
function () {
    // good
    s += (text[i] || '.') + ']'; 
},
function () {
     // bad, but works 
     s += text[i] || '.' + ']'; 
},
function () { 
    // good
    s += '[' + (text[i] || '.'); 
} ,
function () {
    // bad, and fails
    s += '[' + text[i] || '.'; 
},
function () { 
    // good
    s += '[' + (text[i] || '.') + ']'; 
}, 
function () {  
    // bad, and fails      
    s += '[' + text[i] || '.' + ']'; 
}];

for(var j=0; code[j]; j++) {  
 for(var i =0, s =''; i < 10; i++) { 
 code[j]();    
 }
  x.innerHTML += ' <br/>  <br/> ' + s;       
}