Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Split Map Join Not a Number! solution in Creative category for [old] Three Words by JeremyLikness
"use strict";
function threeWords(data) {
var threeInARow = [NaN, NaN, NaN].join(''),
alphaOrNot = data.split(' ').map(function (a) { return Number(a); }).join('');
return alphaOrNot.indexOf(threeInARow) >= 0;
}
var assert = require('assert');
if (!global.is_checking) {
assert.equal(threeWords("one two 3 four five six 7 eight 9 ten eleven 12"), true, "0th example");
assert.equal(threeWords("Hello World hello"), true, "1st example");
assert.equal(threeWords("He is 123 man"), false, "2nd example");
assert.equal(threeWords("1 2 3 4"), false, "3rd example");
assert.equal(threeWords("bla bla bla bla"), true, "4th example");
assert.equal(threeWords("Hi"), false, "Letters");
console.log("Coding complete? Click 'Check' to review your tests and earn cool rewards!");
}
Aug. 22, 2016
Comments: