From the documentation
Arrays and array-like objects with a length
property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
Since x
is an array, only its numeric properties are considered, not its named properties. Since it doesn't have any of these, nothing is printed.
You make it work by using an object instead of an array.
var x = {};
x['abc'] = 'd';
x['xyz'] = 'abbb';
$.each(x, function(i, el) {
console.error(el);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>