day-8.mjs
January 1, 2022 ยท View on GitHub
///////////////////////////////////////////////////////////////////////////////
// Day 8 - Immaculate coercion //
// #region problem //
///////////////////////////////////////////////////////////////////////////////
// Write an object that has 3 different values for +object, object + '', //
// and ${object}. //
///////////////////////////////////////////////////////////////////////////////
const NUMBER_VALUE = 1337;
const STRING_CONCAT_VALUE = string;
const TEMPLATE_VALUE = template;
let object = {
// ...
};
/////////////////////////////////////////////////////////////////////////////// // #endregion problem // ///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// // Test - Leave code after this alone // // #region test // ///////////////////////////////////////////////////////////////////////////////
import assert from 'node:assert/strict';
assert.strictEqual(+object, NUMBER_VALUE);
assert.strictEqual(object + '', STRING_CONCAT_VALUE);
assert.strictEqual(${object}, TEMPLATE_VALUE);
/////////////////////////////////////////////////////////////////////////////// // #endregion test // ///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// // Hints - Encoded in ROT13 encoded // // #region hints // /////////////////////////////////////////////////////////////////////////////// // // // Fvzcyr: inyhrBs, gbFgevat, naq gbCevzvgvir ner nyy pnyyrq qvssreragyl. // // // /////////////////////////////////////////////////////////////////////////////// // #endregion hints // ///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// // Use Cases // // #region uses // /////////////////////////////////////////////////////////////////////////////// // // // This is purely esoterica to my knowledge. // // // /////////////////////////////////////////////////////////////////////////////// // #endregion uses // ///////////////////////////////////////////////////////////////////////////////