Reputation: 4098
On google chrome debugger console:
var array = ['item1'];
array //will print ["item1"]
Object.defineProperty(array, '1', {get: function(){return 'item2';}, set: function(v){}});
array //will print nothing
Is there a way to make the last line print some info? console.log(array) also just prints ['item1']. I just need it for debugging purposes.
This actually works fine in firefox. In Safari I get ["item1", undefined × 1].
Upvotes: 0
Views: 134