I'm trying to take an array object and change its print representation - just of that object, not of all arrays in the program. I hoped setting the toString property would do the job, but it doesn't:
var a = [1, 2, 3]
// Prints using the default representation
console.log(a)
// Try to override toString
a.toString = function() {
return 'some new representation'
}
// Still uses the default representation
console.log(a)
What am I missing?