Skip to content

Instantly share code, notes, and snippets.

@mk-pmb
Last active October 9, 2016 00:22
Show Gist options
  • Save mk-pmb/8d37aa322ccd45d864eecf321247b955 to your computer and use it in GitHub Desktop.
Save mk-pmb/8d37aa322ccd45d864eecf321247b955 to your computer and use it in GitHub Desktop.
Node.js quiz! Can you guess the value?
'use strict';
var a = [], b = [a], eq = require('assert').deepStrictEqual;
function dse(x, y) {
var e;
try {
eq(x, y);
e = '===equal===';
} catch (err) {
e = String(err.message || err);
}
console.log(e);
return e;
}
eq(dse(1, 1), '===equal===');
eq(dse(1, 5), '1 deepStrictEqual 5');
eq(dse(a, b), '[] deepStrictEqual [ [] ]');
eq(dse(b, a), '[ [] ] deepStrictEqual []');
a.push(b);
eq(dse(a, b), '???');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment