mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-28 06:53:42 +08:00
16 lines
491 B
JavaScript
16 lines
491 B
JavaScript
// A CommonJS file under "use strict": a function with named parameters
|
|
// reads `arguments`, which in strict code never aliases those parameters.
|
|
"use strict";
|
|
function wrap(fn, label) {
|
|
label = label + "!";
|
|
return [label, arguments.length, arguments[1], typeof arguments[0]].join(" ");
|
|
}
|
|
function sum(a, b) {
|
|
a = 100;
|
|
let total = 0;
|
|
for (let i = 0; i < arguments.length; i++) total += arguments[i];
|
|
return total;
|
|
}
|
|
console.log(wrap(() => 1, "tag"));
|
|
console.log(sum(1, 2, 3));
|