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
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.