Yes, JavaScript arrays are not associative like php-arrays, they are designed to hold data with numeric indexes. But I understand what you want. JavaScript arrays can contain both object properties (like "string indexes") and numbers in strings (like "number indexes"). You can stringify/serialize it only to plain JavaScript object {"key1": value1, "key2": value2, ...}.
E.g. you want stringify an array a, but avoid null/undefined in output (for clarity question is extended):
a = []; // new Array();
a[0] = "UK";
a[1] = 7;
a["5"] = 8;
a["32"] = 77;
a[7] = 0;
a["8"] = NaN;
a[9] = undefined;
a["10"] = null;
a[11] = {};
a["19"] = false;
a[20] = true;
a['A'] = 'test';
a['B'] = 'test B';
a.push('wonderland');
a.push(98);
a[4294967294] = 42;
delete a[4294967294];
(4294967295) ['UK', 7, empty × 3, 8, empty, 0, NaN, undefined, null, {…}, empty × 7, false, true, empty × 11, 77, 'wonderland', 98, empty × 4294967260, A: 'test', B: 'test B']
a.length
4294967295
So even JSON.stringify(a) could be possible, it will be finished with many nulls (and without 'A', 'B')...
'["UK",7,null,null,null,8,null,0,null,null,null,{},null,null,null,null,null,null,null,false,true,null,null,null,null,null,null,null,null,null,null,null,77,"wonderland",98,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,...
We can fix it with Object.assign!
function replacer (key, value) {
  return (!!value || value === false || value === '' || typeof value === 'number') ? value : undefined;
}
JSON.stringify(Object.assign({}, a), replacer)
Or even simpler:
JSON.stringify(Object.assign({}, a))
'{"0":"UK","1":7,"5":8,"7":0,"8":null,"10":null,"11":{},"19":false,"20":true,"32":77,"33":"wonderland","34":98,"A":"test","B":"test B"}'
Back conversion to array is harder:
jsonObj = JSON.stringify(Object.assign({}, a));
aObj = JSON.parse(jsonObj)
b = []
Object.entries(aObj).forEach(entry => b[entry[0]] = entry[1])
console.log(b)
(35) ['UK', 7, empty × 3, 8, empty, 0, null, empty, null, {…}, empty × 7, false, true, empty × 11, 77, 'wonderland', 98, A: 'test', B: 'test B']
P. S. 1: You can also see, that we filtered null/undefined for extremely long source array (sparse array) a, which was impossible with array.filter.
P. S. 2: But for our specific task, we can not use JSON.stringify(Object.assign([], a)), because we do not want to miss a['A'] = 'test'; a['B'] = 'test B'.
P. S. 3: To avoid using such unintuitive things, you must use Plain Object {} or better Map.
     
    
var test = {};instead