Last active
August 29, 2015 14:28
-
-
Save fwilhe/26d4c7db435b36f17ff2 to your computer and use it in GitHub Desktop.
Local Quick and Dirty JS Scratchpad
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
<!DOCTYPE html> | |
<html lang="en"> | |
<!-- | |
Author: Florian Wilhelm | |
License: MIT | |
http://opensource.org/licenses/MIT | |
--> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Local Quick and Dirty JS Scratchpad</title> | |
</head> | |
<body> | |
<textarea title="code" id="code" cols="80" rows="25"> | |
// Type your javascript here | |
// Hint: alt + x will execute the code | |
var x = [1, 2, 3, 4, 5, 6, 7]; | |
x.forEach(function doSomeThingWith(element) { | |
console.log(element); | |
}); | |
var y = x.every(function (element) { | |
return isFinite(element); | |
}); | |
console.log(y); | |
var z = x.some(function (element) { | |
return element > 5; | |
}); | |
console.log(z); | |
</textarea> | |
<br/> | |
<button accesskey="x" | |
onclick="document.getElementById('output').innerText = eval(document.getElementById('code').value)">run | |
</button> | |
<button accesskey="s" | |
onclick=" | |
var a = document.createElement('a'); | |
a.href = 'data:text/plain;charset=utf-8,' + encodeURIComponent(document.getElementById('code').value); | |
a.download = 'js_scratch_' + Date.now(); | |
a.click(); | |
">save | |
</button> | |
<br/> | |
<textarea id="output" readonly="readonly" title="output" cols="80" rows="25"></textarea> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment