Just ran across this:const a = new Map(); const b = {}; a.set('cat', 'dog'); b.cat = 'dog'; if ('cat' in a) { console.log('yay-map'); } if ('cat' in b) { console.log('yay-object'); } This prints: yay-object but not yay-map why is this?
Submitted July 09, 2017 at 03:27PM by frankimthetank
No comments:
Post a Comment