getTag
getTag returns string representation of Object.We may not expect the right value for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6
We expect
DataView- [object DataView]Map- [object Map]Promise- [object Promise]Set- [object Set]- WeakMap - [object WeakMap]
In all the above cases where we don't get the value as expected, we derive at the object's type using its constructor.
console.log(`${DataView}`)
const o = new DataView(new ArrayBuffer(1))
console.log("Based on o.constructor")
console.log(`${o.constructor}`)
Output:
function DataView() { [native code] }
Based on o.constructor
function DataView() { [native code] }
Comments
Post a Comment