Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First - 2easy solution in Clear category for [old] Word Pattern by vincent.tscherter
"use strict";
function checkCommand(pattern, command){
return pattern == parseInt(command.replace(/\d/g,'0').replace(/\D/g,'1'),2);
}
var assert = require('assert');
if (!global.is_checking) {
assert.equal(checkCommand(42, "12a0b3e4"), true, "42 is the answer");
assert.equal(checkCommand(101, "ab23b4zz"), false, "one hundred plus one");
assert.equal(checkCommand(0, "478103487120470129"), true, "Any number");
assert.equal(checkCommand(127, "Checkio"), true, "Uppercase");
assert.equal(checkCommand(7, "Hello"), false, "Only full match");
assert.equal(checkCommand(8, "a"), false, "Too short command");
assert.equal(checkCommand(5, "H2O"), true, "Water");
assert.equal(checkCommand(42, "C2H5OH"), false, "Yep, this is not the Answer");
console.log("Coding complete? Click 'Check' to review your tests and earn cool rewards!");
}
June 29, 2017