Created
August 21, 2010 16:36
-
-
Save banksean/542534 to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-16" /> | |
<title> | |
λ in JavaScript | |
</title> | |
<script type='text/javascript'> | |
Array.prototype.forEach = function(λ) { | |
for (var i = 0; i < this.length; i++) { | |
λ(this[i]); | |
} | |
} | |
function testλ() { | |
var a = [1, 2, 3]; | |
a.forEach(function(el) { | |
document.body.innerHTML += (el + "<br/>"); | |
}); | |
} | |
</script> | |
<body onload="testλ()"> | |
<div> | |
Testing λ as a function name in javascript: | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment