Skip to content

Instantly share code, notes, and snippets.

@banksean
Created August 21, 2010 16:36
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 banksean/542534 to your computer and use it in GitHub Desktop.
Save banksean/542534 to your computer and use it in GitHub Desktop.
<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