JavaScript Language Support
Capabilities aligned with src/core.cpp and src/internal.cpp. Explicit semicolons are recommended in production scripts.
Literals & types
undefined; null; true; false;
123; 3.14; 0x10;
"abc"; 'xyz';
({a:1, b:2});
[1, 2, 3];
Variables
letandconst(notvar)- Compound assignment:
+= -= *= /= %=and bitwise variants - Postfix
i++/i-- - Reassigning
constthrowsassignment to constant
Operators
Arithmetic (+ - * / % **), bitwise, comparison, loose/strict equality, logical, ternary, and typeof.
Control flow
if/else, for, while, do...while, switch, break, continue, try/catch/finally, throw, return.
Functions & closures
- Function declarations and expressions, IIFE
- Arrow functions:
x => x*2,(a,b) => a+b, block bodies - Lexical closures — nested functions capture defining scope
for (let i = 0; ...)creates a per-iteration binding (loop closure works correctly)
// Closure example
function a() {
let x = 1;
function b() {
let y = 2;
return function c() { return x + y; };
}
return b();
}
a()(); // 3
// Loop closure
let funcs = [];
for (let i = 0; i < 3; i++) {
funcs[i] = function() { return i; };
}
funcs[0](); // 0
Core built-ins (no extensions)
String methods
length, charCodeAt, charAt, indexOf, substring
Array methods
push, pop, shift, slice, reverse, sort, splice, forEach, map, every, some, find, findIndex, reduce, indexOf, join
Unsupported (current)
| Feature | Notes |
|---|---|
var, class, new | Parse / runtime error |
this, delete, with | Not implemented |
yield, void, in, instanceof | Not implemented |
| ES modules, Promise, prototype chain | Not supported |
Common errors
parse error, ; expected, type mismatch, 'xxx' not found, oom, C stack — most include at line N col M.