Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

λ and function javascript

Tags:

javascript

is there any way to map the λ key to the function keyword? so that these work:

var rFalse = λ() {
  return false;
}

(λ(){
  var str = "i'm in a closure";
}());

window.onload = λ() {
  alert('window loaded');
}

I know that they are attempting to put a shortened function keyword in ecmascript v6, but I'm wondering if it is possible to do it now.

like image 629
Rixius Avatar asked Sep 17 '26 00:09

Rixius


1 Answers

JavaScript does not offer aliasing of keywords, so it is not possible make the syntax you're trying to use valid.

like image 54
Matt Avatar answered Sep 18 '26 14:09

Matt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!