This file is auto-generated by scripts/generate_reference.js.
Regenerate this file with:
crystal run src/giavascript_cli.cr -- scripts/generate_reference.js
Source files:
reference/Language.md
reference/Types.md
reference/Math.md
reference/JSON.md
Status of core JavaScript language features in GiavaScript.
| Feature | Status |
|---|
var declaration | Available |
var without initializer | Available |
Reassignment with = | Available |
Compound assignment (+=, -=, *=, /=) | Available |
Postfix increment and decrement (++, --) | Available |
import "file.js" | Available |
let | Not available |
const | Not available |
| Feature | Status |
|---|
Numeric literals (int, float) | Available |
| String literals (single and double quotes) | Available |
Arithmetic (+, -, *, /, %) | Available |
Exponent operator (^, non-standard) | Available |
| Parenthesized expressions | Available |
Comparisons (<, >, <=, >=) | Available |
Equality (==, !=) | Available |
Strict equality (===, !==) | Available |
Logical operators (&&, ||, !) | Available |
typeof operator | Available |
void operator | Available |
Unary plus (+) | Available |
Comments (//, /* */) | Available |
| Template literals | Available |
== and != use coercive (loose) equality behavior.
=== and !== use strict (non-coercive) equality behavior.
typeof returns string representations of value types:
"number" for Int32 and Float64
"string" for String
"boolean" for Bool
"object" for Array, Hash, and null
"function" for callable values (user-defined and built-in)
"undefined" for undefined and undeclared identifiers (does not throw)
a && b: evaluates a first; if a is falsy, returns a and does not evaluate b; otherwise evaluates and returns b.
a || b: evaluates a first; if a is truthy, returns a and does not evaluate b; otherwise evaluates and returns b.
!a: evaluates a and returns a boolean negation (true/false).
a ? b : c: evaluates a first; if a is truthy, evaluates and returns b; otherwise evaluates and returns c.
- Precedence:
! binds tighter than &&, && binds tighter than ||, and || binds tighter than ? :.
- Rest parameter (
...name) must be the last formal parameter; otherwise an error is raised.
- Rest parameters are supported in function declarations, function expressions, and arrow functions.
- Rest parameter gathers exceeding arguments into an array. If there are no exceeding arguments, the rest array is empty (
[]).
- Spread in arrays (
[...arr]) creates a shallow copy by iterating elements into a new array. Non-array spread values are silently ignored.
- Spread in objects (
{...obj}) copies own properties into a new object. Later keys override earlier ones. Non-object spread values are silently ignored.
- Spread in function call arguments (
fn(...arr)) expands an array into individual arguments. Non-array spread values are silently ignored.
- Duplicate parameter names (including rest) are rejected.
| Feature | Status |
|---|
Function declarations (function name(...) { ... }) | Available |
Function expressions (var f = function(...) { ... }) | Available |
Named function expressions (var f = function name(...) { ... }) | Available |
Arrow functions (() => expr, x => expr, () => { ... }) | Available |
| Function calls | Available |
Spread in call arguments (fn(...arr)) | Available |
Rest parameters (function f(a, ...rest), arrow functions) | Available |
Returning values with return | Available |
| First-class function values | Available |
if, else if, else | Available |
C-style for loops (for (init; condition; update)) | Available |
for...of loops (iterate over arrays and strings) | Available |
for...in loops (iterate over object keys) | Available |
break / continue inside loops | Available |
while / do...while loops | Available |
Ternary operator (a ? b : c) | Available |
switch statements | Available |
throw statements | Available |
try / catch / finally | Available |
| Feature | Status |
|---|
null | Available |
undefined | Available |
| Array literals and indexing | Available |
Spread in arrays ([...arr]) | Available |
| Object literals | Available |
Spread in objects ({...obj}) | Available |
| Dot and bracket property access | Available |
| Template literals | Available |
| Feature | Status |
|---|
parseInt() | Available |
parseFloat() | Available |
isNaN() | Available |
readLine() | Available |
Date.now() | Available |
new Date() | Available |
console.log() | Available |
console.warn() | Available |
console.error() | Available |
File.read() | Available |
File.readLines() | Available |
File.write() | Available |
File.append() | Available |
- This reflects the current behavior in the interpreter and specs.
let and const declarations return explicit errors: Error: unsupported declaration 'let' and Error: unsupported declaration 'const'.
- Use
var for variable declarations.
- Statements can be separated by newlines without requiring semicolons. A semicolon is not required when two statements are on separate lines.
Status of built-in methods and properties on GiavaScript runtime types.
| Member | Kind | Status |
|---|
length | Instance property | Available |
at() | Instance method | Available |
charAt() | Instance method | Available |
charCodeAt() | Instance method | Available |
codePointAt() | Instance method | Available |
concat() | Instance method | Available |
endsWith() | Instance method | Available |
fromCharCode() | Static method | Available |
includes() | Instance method | Available |
indexOf() | Instance method | Available |
isWellFormed() | Instance method | Available |
lastIndexOf() | Instance method | Available |
localeCompare() | Instance method | Available |
match() | Instance method | Available |
matchAll() | Instance method | Available |
padEnd() | Instance method | Available |
padStart() | Instance method | Available |
repeat() | Instance method | Available |
replace() | Instance method | Available |
replaceAll() | Instance method | Available |
search() | Instance method | Available |
slice() | Instance method | Available |
split() | Instance method | Available |
startsWith() | Instance method | Available |
substr() | Instance method | Not available |
substring() | Instance method | Available |
toLocaleLowerCase() | Instance method | Available |
toLocaleUpperCase() | Instance method | Available |
toLowerCase() | Instance method | Available |
toString() | Instance method | Available |
toUpperCase() | Instance method | Available |
toWellFormed() | Instance method | Available |
trim() | Instance method | Available |
trimEnd() | Instance method | Available |
trimStart() | Instance method | Available |
valueOf() | Instance method | Available |
| Member | Kind | Status |
|---|
isFinite() | Static method | Available |
isInteger() | Static method | Available |
isNaN() | Static method | Available |
toString() | Instance method | Available |
| Member | Kind | Status |
|---|
from() | Static method | Available |
fromAsync() | Static method | Not available |
isArray() | Static method | Available |
of() | Static method | Available |
length | Instance property | Available |
at() | Instance method | Available |
concat() | Instance method | Available |
copyWithin() | Instance method | Available |
entries() | Instance method | Available |
every() | Instance method | Available |
fill() | Instance method | Available |
filter() | Instance method | Available |
find() | Instance method | Available |
findIndex() | Instance method | Available |
findLast() | Instance method | Available |
findLastIndex() | Instance method | Available |
flat() | Instance method | Available |
flatMap() | Instance method | Available |
forEach() | Instance method | Available |
includes() | Instance method | Available |
indexOf() | Instance method | Available |
join() | Instance method | Available |
keys() | Instance method | Available |
lastIndexOf() | Instance method | Available |
map() | Instance method | Available |
pop() | Instance method | Available |
push() | Instance method | Available |
reduce() | Instance method | Available |
reduceRight() | Instance method | Available |
reverse() | Instance method | Available |
shift() | Instance method | Available |
slice() | Instance method | Available |
some() | Instance method | Available |
sort() | Instance method | Available |
splice() | Instance method | Available |
toLocaleString() | Instance method | Not available |
toReversed() | Instance method | Not available |
toSorted() | Instance method | Not available |
toSpliced() | Instance method | Not available |
toString() | Instance method | Available |
unshift() | Instance method | Available |
values() | Instance method | Available |
with() | Instance method | Not available |
- In array methods that accept callbacks, JavaScript-compatible argument normalization applies to user-defined function expressions and references to function declarations.
- Extra callback arguments are ignored.
- Missing callback arguments are passed as
undefined.
| Member | Kind | Status |
|---|
assign() | Static method | Available |
entries() | Static method | Available |
hasOwn() | Static method | Available |
keys() | Static method | Available |
toString() | Instance method | Available |
values() | Static method | Available |
| Member | Kind | Status |
|---|
toString() | Instance method | Available |
| Member | Kind | Status |
|---|
getTime() | Instance method | Available |
toString() | Instance method | Available |
- In Node.js,
Date.prototype.toString() usually prints a locale/timezone representation.
- In GiavaScript,
Date.prototype.toString() returns a UTC ISO-like string (YYYY-MM-DDTHH:mm:ss.SSSZ) by design.
| Member | Kind | Status |
|---|
Error() | Constructor | Available |
message | Instance property | Available |
name | Instance property | Available |
stack | Instance property | Available |
toString() | Instance method | Available |
TypeError() | Constructor | Available |
ReferenceError() | Constructor | Available |
SyntaxError() | Constructor | Available |
new Error("message") creates an error object with the given message.
name defaults to "Error". Subtypes use their constructor name.
stack returns a string representation of the call stack.
toString() returns "name: message".
- Error objects can be thrown with
throw and caught with try/catch.
- Raw value throws continue to work alongside Error objects.
- This reflects the current behavior in the interpreter and specs.
Status of the JavaScript Math global object in GiavaScript.
| Member | Kind | Status |
|---|
E | Static property | Available |
LN10 | Static property | Available |
LN2 | Static property | Available |
LOG10E | Static property | Available |
LOG2E | Static property | Available |
PI | Static property | Available |
SQRT1_2 | Static property | Available |
SQRT2 | Static property | Available |
abs() | Static method | Available |
sqrt() | Static method | Available |
acos() | Static method | Available |
acosh() | Static method | Available |
asin() | Static method | Available |
asinh() | Static method | Available |
atan() | Static method | Available |
atan2() | Static method | Available |
atanh() | Static method | Available |
cbrt() | Static method | Available |
ceil() | Static method | Available |
clz32() | Static method | Available |
cos() | Static method | Available |
cosh() | Static method | Available |
exp() | Static method | Available |
expm1() | Static method | Available |
f16round() | Static method | Available |
floor() | Static method | Available |
fround() | Static method | Available |
hypot() | Static method | Available |
imul() | Static method | Available |
log() | Static method | Available |
log10() | Static method | Available |
log1p() | Static method | Available |
log2() | Static method | Available |
max() | Static method | Available |
min() | Static method | Available |
pow() | Static method | Available |
random() | Static method | Available |
round() | Static method | Available |
sign() | Static method | Available |
sin() | Static method | Available |
sinh() | Static method | Available |
sumPrecise() | Static method | Available |
tan() | Static method | Available |
tanh() | Static method | Available |
trunc() | Static method | Available |
Math.random() returns a pseudo-random number in the range [0, 1).
Math.random() is not cryptographically secure.
Math.max() with zero arguments returns -Infinity. Math.min() with zero arguments returns Infinity.
- All Math methods that accept numeric arguments coerce non-numeric values to numbers. Invalid coercions produce
NaN or Infinity as appropriate.
Status of the JavaScript JSON global object in GiavaScript.
| Member | Kind | Status |
|---|
parse() | Static method | Available |
stringify() | Static method | Available |
JSON is exposed as a global object.
JSON.parse(string) requires exactly one string argument.
JSON.parse(string) returns runtime values (object, array, number, boolean, null, or string).
JSON.stringify(value) requires exactly one argument.
JSON.stringify(undefined) and JSON.stringify(function) return undefined.
- In objects,
undefined and function values are omitted.
- In arrays,
undefined and function values serialize as null.
- Non-finite numbers (
NaN, Infinity, -Infinity) serialize as null.
- Circular arrays and objects raise an error.