| 1 |
// This Source Code Form is subject to the terms of the Mozilla Public |
| 2 |
// License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 |
// file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 4 |
|
| 5 |
js> version(180) |
| 6 |
0 |
| 7 |
js> x = function(x) x; |
| 8 |
|
| 9 |
function (x) x |
| 10 |
|
| 11 |
js> x.toSource() |
| 12 |
(function (x) x) |
| 13 |
js> x(123) === 123 |
| 14 |
true |
| 15 |
js> x = function([a, b]) a + b; |
| 16 |
|
| 17 |
function ([a, b]) a + b |
| 18 |
|
| 19 |
js> x([1, 2]) |
| 20 |
3 |
| 21 |
js> x.toSource() |
| 22 |
(function ([a, b]) a + b) |
| 23 |
js> function outer() { |
| 24 |
> var k = function(a) a + 1; |
| 25 |
> return function(b) k(b) * 2; |
| 26 |
> } |
| 27 |
js> outer |
| 28 |
|
| 29 |
function outer() { |
| 30 |
var k = function (a) a + 1; |
| 31 |
return function (b) k(b) * 2; |
| 32 |
} |
| 33 |
|
| 34 |
js> outer() |
| 35 |
|
| 36 |
function (b) k(b) * 2 |
| 37 |
|
| 38 |
js> outer()(4) |
| 39 |
10 |
| 40 |
js> outer()(5) |
| 41 |
12 |
| 42 |
|