You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy and paste the following into RunKit and I would expect the second and third console.log statements to print 'def', but they print undefined. Perhaps I'm missing something? The documentation seems pretty clear so I'm somewhat at a loss.
const Map = require('collections/map');
const foo = new Map();
foo.set('a', 'aa');
foo.set('b', 'bb');
foo.set('c', 'cc');
// EXISTING VALUE
let a = foo.get('a');
console.log(a);
// >>> 'aa'
// DEFAULT ARGUMENT
let def = foo.get('d', 'def');
console.log(def);
// >>> undefined
// DEFAULT FUNCTION SET
foo.getDefault = function() {
return 'def';
};
let def2 = foo.get('d');
console.log(def2);
// >>> undefined
The text was updated successfully, but these errors were encountered:
Copy and paste the following into RunKit and I would expect the second and third console.log statements to print 'def', but they print undefined. Perhaps I'm missing something? The documentation seems pretty clear so I'm somewhat at a loss.
The text was updated successfully, but these errors were encountered: