function isContains(number, array) { var dig = number.toString(), outArr ; outArr = array.filter(function(num) { return dig.indexOf(num)!=-1; }); return outArr.join(',')==array.join(','); } alert(isContains(149, [4,9]))