function createArr(n, name){
var tempArr = new Array(n)
for(var k=0; k<n; k++){
tempArr[k] = 1+Math.floor(10*Math.random())
}
window[name] = tempArr;
};
createArr(5, 'test');
console.log(test);
var arr = ["32", "8", "12", "36", "14", "54"];
var txt = arr.join('');
var check = {};
for( var i = 0; i < txt.length; i++ ) {
if( check[txt[i]] ) {
check[txt[i]]++;
} else {
check[txt[i]] = 1;
}
}
console.log(check);
// Вывод: { "1": 2, "2": 2, "3": 2, "4": 2, "5": 1, "6": 1, "8": 1 }