Q:

How to push a data exactly to required index in an array

I am trying to push a data at the exact position to an array but the result i am getting is wrong...
any one show me the correct way to do this? 
my code :
var ar = ['one','two','three'];

ar[5] = 'five';

ar.join();

console.log(ar); //result ["one", "two", "three", 5: "five"]

the result i am looking is :
["one", "two", "three", "", "", "five"]

Update
Live

A:

ar.join() doesn't change ar.   This should accomplish what you're looking for, as long as you don't have pipes (|) in your data:

console.clear();
var ar = ['one','two','three'];

ar[5] = 'five';

console.log(ar);  //["one", "two", "three", 5: "five"]

ar= ar.join('|').split('|');

console.log(ar);  //["one", "two", "three", "", "", "five"]

