1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 18:35:07 +00:00
serenity/Libraries/LibJS/Tests/var-multiple-declarator.js
Andreas Kling 5e40aa182b LibJS: Support VariableDeclaration with multiple declarators
This patch adds support in the parser and interpreter for this:

    var a = 1, b = 2, c = a + b;

VariableDeclaration is now a sequence of VariableDeclarators. :^)
2020-04-04 21:47:12 +02:00

11 lines
215 B
JavaScript

function assert(x) { if (!x) throw 1; }
try {
var a = 1, b = 2, c = a + b;
assert(a === 1);
assert(b === 2);
assert(c === 3);
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}