Skip to content

Instantly share code, notes, and snippets.

@sydlawrence
Last active December 24, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sydlawrence/6812207 to your computer and use it in GitHub Desktop.
Save sydlawrence/6812207 to your computer and use it in GitHub Desktop.
Javascript under pressure cheats...
// 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