-
Notifications
You must be signed in to change notification settings - Fork 1
StdLib Global Console
Roger Johansson edited this page Jan 14, 2026
·
1 revision
Global functions available without qualification, and the console API.
Implementation Status: 100% Complete
| Function | Status | Description |
|---|---|---|
eval(code) |
Implemented | Evaluates JavaScript code |
parseInt(string, radix) |
Implemented | Parses integer (radix 2-36) |
parseFloat(string) |
Implemented | Parses floating-point |
isNaN(value) |
Implemented | Checks for NaN (coerces to number) |
isFinite(value) |
Implemented | Checks for finite (coerces to number) |
encodeURI(uri) |
Implemented | Encodes URI |
decodeURI(uri) |
Implemented | Decodes URI |
encodeURIComponent(str) |
Implemented | Encodes URI component |
decodeURIComponent(str) |
Implemented | Decodes URI component |
escape(string) |
Implemented | URL encoding (deprecated) |
unescape(string) |
Implemented | URL decoding (deprecated) |
globalThis |
Implemented | Reference to global object |
Full implementation supporting:
- Direct eval (caller's scope)
- Indirect eval (global scope)
- Strict mode propagation
- Private name validation
- Super reference validation
// Direct eval - uses local scope
function f() {
const x = 1;
return eval("x"); // 1
}
// Indirect eval - uses global scope
const geval = eval;
function g() {
const x = 1;
return geval("x"); // ReferenceError
}// Identical behavior
parseInt("42", 10); // 42
Number.parseInt("42", 10); // 42
// Auto-detect hex
parseInt("0xFF"); // 255
parseInt("0xFF", 16); // 255
parseInt("FF", 16); // 255// Global isNaN coerces to number first
isNaN("hello"); // true (coerces to NaN)
isNaN(undefined); // true (coerces to NaN)
// Number.isNaN is type-strict
Number.isNaN("hello"); // false (not a number)
Number.isNaN(NaN); // true| Function | Reserved Characters |
|---|---|
encodeURI |
;/?:@&=+$,# (not encoded) |
encodeURIComponent |
None (all special chars encoded) |
const url = "https://example.com/?q=hello world";
encodeURI(url); // "https://example.com/?q=hello%20world"
encodeURIComponent(url); // "https%3A%2F%2Fexample.com%2F%3Fq%3Dhello%20world"Implementation Status: Partial (5/18 methods)
| Method | Status | Description |
|---|---|---|
console.log(...args) |
Implemented | Outputs to stdout |
console.error(...args) |
Implemented | Outputs to stderr |
console.warn(...args) |
Implemented | Outputs with "Warning: " prefix |
console.info(...args) |
Implemented | Outputs to stdout |
console.debug(...args) |
Implemented | Outputs with "Debug: " prefix |
| Method | Status | Description |
|---|---|---|
console.trace() |
Not Implemented | Stack trace |
console.time(label) |
Not Implemented | Start timer |
console.timeEnd(label) |
Not Implemented | End timer |
console.timeLog(label) |
Not Implemented | Log timer |
console.assert(condition, ...args) |
Not Implemented | Conditional log |
console.count(label) |
Not Implemented | Count calls |
console.countReset(label) |
Not Implemented | Reset count |
console.group(label) |
Not Implemented | Start group |
console.groupEnd() |
Not Implemented | End group |
console.groupCollapsed(label) |
Not Implemented | Collapsed group |
console.clear() |
Not Implemented | Clear console |
console.dir(obj) |
Not Implemented | Object inspection |
console.table(data) |
Not Implemented | Tabular display |
console.log("Hello", "World"); // "Hello World"
console.log({ x: 1, y: 2 }); // {"x":1,"y":2}
console.log([1, 2, 3]); // [1,2,3]
console.log(function f() {}); // [Function]
console.log(null, undefined); // "null undefined"| Property | Value |
|---|---|
globalThis |
The global object |
undefined |
The undefined value |
NaN |
Not-a-Number |
Infinity |
Positive infinity |
| Category | Files |
|---|---|
| Global Functions | StdLib/Global/GlobalHelper.cs |
| eval | StdLib/Global/EvalHostFunction.cs |
| Console | StdLib/Console/ConsolePrototype.cs |
- StdLib-Number-Math - Number.parseInt/parseFloat comparison
- JsEnvironment-and-Slots - How eval accesses scopes