From dea978cda53392281afae2ba57f9e310d8b395e7 Mon Sep 17 00:00:00 2001 From: Vladimir Ananiev Date: Thu, 25 Oct 2018 14:34:19 +0300 Subject: Homework 1 JavaScript highlighter in JavaScript (#14) * Js2Html in Js * remove screenshot --- homework/81459/js2html/testfile.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 homework/81459/js2html/testfile.js (limited to 'homework/81459/js2html/testfile.js') diff --git a/homework/81459/js2html/testfile.js b/homework/81459/js2html/testfile.js new file mode 100644 index 0000000..0097012 --- /dev/null +++ b/homework/81459/js2html/testfile.js @@ -0,0 +1,35 @@ +class Nonsense { + constructor() { + this.arbitraryArray = ['string with no meaning', 42]; + } + + doesThisMakeSense() { + return false; + } + + answer(answer) { + console.log(answer); + } + + whatIsTheMeaning() { + return this.arbitraryArray[this.getRandomIndex()] + } + + getRandomIndex() { + return Math.floor(Math.random() * 2); + } +} + +(function () { + console.log((-~function(){}-~function(){})); // 2, now that's weird + console.log(Array(16).join("lol" - 2) + " Batman!"); // ;) + + + const nonsense = new Nonsense(); + + while(nonsense.doesThisMakeSense()) { // No, it doesn't + nonsense.answer(nonsense.whatIsTheMeaning()); + } +})(); + + -- cgit v1.3.1-26-gb76a