So i was working on a function which takes anything as argument and console logs it inside a box or a cell. This is what i came up with:
var horiz='━';
var vert='┃';
var ulcor='┏';
var urcor='┓';
var blcor='┗';
var brcor='┛';
//create a cell/box
var cell=(d='')=>{
    let h='';
    if(d==undefined||d==null){
        throw('cell needs an argument');
    }
    len=d.toString().length;
    for(i=0;i<3;i++){
        if(i==0){
            for(j=0;j<len;j++){
                h+=horiz;
            }
            if(i==0) console.log(ulcor+h+urcor);
        }
        if(i==1){
            console.log(`${vert}${d}${vert}`);
        }
        if(i==2){
           console.log(blcor+h+brcor);    
        }
    }
}
Now when i was testing this i did following
cell('index');
cell(1);
gave following output:
┏━━━━━┓
┃index┃
┗━━━━━┛
┏━┓
┃1┃
┗━┛
and did other testing as well and it worked pretty well until i did the following test:
for(i=0;i<5;i++){
   cell(i)
}
Above code should give me cells/boxes with 1,2,3,4 but instead this gave me an infinite loop and what i noticed is that its only printing cells with 4 (not 1,2 or 3) but infinite times. 
And now here is the fun part. When I do following:
n=1;
while(n<10){
  cell(n);
  n+=1;
}
above code gives desired result and works fine. 
Weird!! just Couldn't figure out why its running infinite times when i used it in the for loop but while loop works good. If any sort of improvement required in the code then please do mention it:)
 
    