I have this two arrays
var refArray = [\'India\',\'Pakistan\',\'Nepal\',\'Bhutan\',\'SreeLanka\',\'Singapore\',\'Thailand\',\'China\',\'Russia\']
var beenThere
a faster way is to use the pre-sorted array as a template, and limit the indexOf() work to a single indexOf() call on the sub-set items, instead of 2-indexOf() calls on all items.
var refArray = ['India','Pakistan','Nepal','Bhutan','SreeLanka','Singapore','Thailand','China','Russia']
var beenThere = ['Russia','Bhutan','India'];
function contains(a){return this.indexOf(a)!==-1; }
refArray.filter(contains, beenThere); // == ["India", "Bhutan", "Russia"]