Last active
December 24, 2015 14:19
-
-
Save sydlawrence/6812207 to your computer and use it in GitHub Desktop.
Javascript under pressure cheats...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Paste these in chunks into the developer console. BEFORE you press "Start game" | |
startGame(); | |
editor.setValue("function doubleInteger(i) { return i*2; }"); | |
runCode(); | |
// wait for the previous tests to run and succeed, then paste the next | |
runCode(); | |
editor.setValue("function isNumberEven(i) { return !(i%2); }"); | |
runCode(); | |
// wait for the previous tests to run and succeed, then paste the next | |
runCode(); | |
editor.setValue("function getFileExtension(i) { var s = i.split('.'); return (s.length > 1) ? s[1] : false; }"); | |
runCode(); | |
// wait for the previous tests to run and succeed, then paste the next | |
runCode(); | |
editor.setValue("function longestString(i) { var l = ''; for (var j in i) if (i[j].length > l.length && typeof i[j] === 'string') l = i[j]; return l; }"); | |
runCode(); | |
// wait for the previous tests to run and succeed, then paste the next | |
runCode(); | |
editor.setValue("function arraySum(i) { var s = 0; for (var j in i) { if (typeof i[j] === 'number') s += i[j]; if (typeof i[j] === 'object') s += arraySum(i[j]); } return s; }"); | |
runCode(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment