| // This Source Code Form is subject to the terms of the Mozilla Public | |
| // License, v. 2.0. If a copy of the MPL was not distributed with this | |
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
| js> function sum(acc, val) { return acc + val; }; | |
| js> [1, 4, 9, 16].reduce; | |
| function reduce() { | |
| [native code] | |
| } | |
| js> [1, 4, 9, 16].reduce(sum); | |
| 30 | |
| js> Array.reduce; | |
| function reduce() { | |
| [native code] | |
| } | |
| js> Array.reduce([1, 4, 9, 16], sum); | |
| 30 |