Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/arguments/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 812 B image not shown  

Quelle  rest-with-arguments.js

  Sprache: JAVA
 

// 'arguments' is allowed with rest parameters.

var args;

function restWithArgs(a, b, ...rest) {
    return arguments;
}

args = restWithArgs(1369);
assertEq(args.length, 4);
assertEq(JSON.stringify(args), '{"0":1,"1":3,"2":6,"3":9}');

args = restWithArgs();
assertEq(args.length, 0);

args = restWithArgs(45);
assertEq(args.length, 2);
assertEq(JSON.stringify(args), '{"0":4,"1":5}');

function restWithArgsEval(a, b, ...rest) {
    return eval("arguments");
}

args = restWithArgsEval(1369);
assertEq(args.length, 4);
assertEq(JSON.stringify(args), '{"0":1,"1":3,"2":6,"3":9}');

function g(...rest) {
    h();
}
function h() {
    g.arguments;
}
g();

// eval() is evil, but you can still use it with rest parameters!
function still_use_eval(...rest) {
    eval("x = 4");
}
still_use_eval();

Messung V0.5 in Prozent
C=92 H=82 G=86

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.