Skip to content

Instantly share code, notes, and snippets.

@mihailik mihailik/index.html
Last active Aug 29, 2015

Embed
What would you like to do?
Recursive let
<html>
<pre id=myscriptout>
</pre>
<div id=myout>
</div>
<script id=myfunc type=text>
function ro() {
"use strict";
let x = Date.now() < 0 ? x : 10;
return x;
}
document.getElementById('myout').textContent = ro();
document.getElementById('myscriptout').textContent = ro;
</script>
<script type="application/javascript;version=1.7">
// this has a 'modern' type valid for FireFox
try { eval(document.getElementById('myfunc').textContent); }
catch (err) { document.getElementById('myout').textContent = err + ' ' + err.stack; window.ro = 1; }
</script>
<script>
// for browsers not getting that ;version=1.7 suffix
if (!window.ro) {
try { eval(document.getElementById('myfunc').textContent); }
catch (err) { document.getElementById('myout').textContent = err + ' ' + err.stack; }
}
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.