Very simple JS Engine with basic expressions support:
- Binary expressions like
1+(3+5)*3*(3+10)
- Variables and changing variables:
let x = 10;
let b = 30 + 1;
b = b + 5;
x + b // evaluates to JSNumber { value: 46 }
- Strings
let x = "Hello World"
x // evaluates to JSString { value: "Hello World" }
- Block scoping
// its own scope
{
let x = 1;
}
- Functions
function x(a, b) {
return a + b;
}
x(2, 3); // evaluates to 5
- Objects
let obj = {a: 3, b: "Hello World"}; // evaluates to JSObject { value: HashMap /w "a" - 3 as JSNumber and "b" - "Hello World" as JSString }