GiavaScript JavaScript Feature Reference

July 3, 2026 ยท View on GitHub

This file is auto-generated by scripts/generate_reference.js.

Table of Contents

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

Language Features

Status of core JavaScript language features in GiavaScript.

Declarations and assignments

FeatureStatus
var declarationAvailable
var without initializerAvailable
Reassignment with =Available
Compound assignment (+=, -=, *=, /=)Available
Postfix increment and decrement (++, --)Available
import "file.js"Available
letNot available
constNot available

Expressions and operators

FeatureStatus
Numeric literals (int, float)Available
String literals (single and double quotes)Available
Arithmetic (+, -, *, /, %)Available
Exponent operator (^, non-standard)Available
Parenthesized expressionsAvailable
Comparisons (<, >, <=, >=)Available
Equality (==, !=)Available
Strict equality (===, !==)Available
Logical operators (&&, ||, !)Available
typeof operatorAvailable
void operatorAvailable
Unary plus (+)Available
Comments (//, /* */)Available
Template literalsAvailable

Equality operator semantics

  • == and != use coercive (loose) equality behavior.
  • === and !== use strict (non-coercive) equality behavior.

typeof semantics

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)

Logical operator semantics

  • 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 ? :.

Spread and rest parameter semantics

  • 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.

Functions and control flow

FeatureStatus
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 callsAvailable
Spread in call arguments (fn(...arr))Available
Rest parameters (function f(a, ...rest), arrow functions)Available
Returning values with returnAvailable
First-class function valuesAvailable
if, else if, elseAvailable
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 loopsAvailable
while / do...while loopsAvailable
Ternary operator (a ? b : c)Available
switch statementsAvailable
throw statementsAvailable
try / catch / finallyAvailable

Values and collections

FeatureStatus
nullAvailable
undefinedAvailable
Array literals and indexingAvailable
Spread in arrays ([...arr])Available
Object literalsAvailable
Spread in objects ({...obj})Available
Dot and bracket property accessAvailable
Template literalsAvailable

Classic global functions

FeatureStatus
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

Notes

  • 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.

Type Methods and Properties

Status of built-in methods and properties on GiavaScript runtime types.

String

MemberKindStatus
lengthInstance propertyAvailable
at()Instance methodAvailable
charAt()Instance methodAvailable
charCodeAt()Instance methodAvailable
codePointAt()Instance methodAvailable
concat()Instance methodAvailable
endsWith()Instance methodAvailable
fromCharCode()Static methodAvailable
includes()Instance methodAvailable
indexOf()Instance methodAvailable
isWellFormed()Instance methodAvailable
lastIndexOf()Instance methodAvailable
localeCompare()Instance methodAvailable
match()Instance methodAvailable
matchAll()Instance methodAvailable
padEnd()Instance methodAvailable
padStart()Instance methodAvailable
repeat()Instance methodAvailable
replace()Instance methodAvailable
replaceAll()Instance methodAvailable
search()Instance methodAvailable
slice()Instance methodAvailable
split()Instance methodAvailable
startsWith()Instance methodAvailable
substr()Instance methodNot available
substring()Instance methodAvailable
toLocaleLowerCase()Instance methodAvailable
toLocaleUpperCase()Instance methodAvailable
toLowerCase()Instance methodAvailable
toString()Instance methodAvailable
toUpperCase()Instance methodAvailable
toWellFormed()Instance methodAvailable
trim()Instance methodAvailable
trimEnd()Instance methodAvailable
trimStart()Instance methodAvailable
valueOf()Instance methodAvailable

Number

MemberKindStatus
isFinite()Static methodAvailable
isInteger()Static methodAvailable
isNaN()Static methodAvailable
toString()Instance methodAvailable

Array

MemberKindStatus
from()Static methodAvailable
fromAsync()Static methodNot available
isArray()Static methodAvailable
of()Static methodAvailable
lengthInstance propertyAvailable
at()Instance methodAvailable
concat()Instance methodAvailable
copyWithin()Instance methodAvailable
entries()Instance methodAvailable
every()Instance methodAvailable
fill()Instance methodAvailable
filter()Instance methodAvailable
find()Instance methodAvailable
findIndex()Instance methodAvailable
findLast()Instance methodAvailable
findLastIndex()Instance methodAvailable
flat()Instance methodAvailable
flatMap()Instance methodAvailable
forEach()Instance methodAvailable
includes()Instance methodAvailable
indexOf()Instance methodAvailable
join()Instance methodAvailable
keys()Instance methodAvailable
lastIndexOf()Instance methodAvailable
map()Instance methodAvailable
pop()Instance methodAvailable
push()Instance methodAvailable
reduce()Instance methodAvailable
reduceRight()Instance methodAvailable
reverse()Instance methodAvailable
shift()Instance methodAvailable
slice()Instance methodAvailable
some()Instance methodAvailable
sort()Instance methodAvailable
splice()Instance methodAvailable
toLocaleString()Instance methodNot available
toReversed()Instance methodNot available
toSorted()Instance methodNot available
toSpliced()Instance methodNot available
toString()Instance methodAvailable
unshift()Instance methodAvailable
values()Instance methodAvailable
with()Instance methodNot available

Array callback argument behavior

  • 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.

Object

MemberKindStatus
assign()Static methodAvailable
entries()Static methodAvailable
hasOwn()Static methodAvailable
keys()Static methodAvailable
toString()Instance methodAvailable
values()Static methodAvailable

Boolean

MemberKindStatus
toString()Instance methodAvailable

Date

MemberKindStatus
getTime()Instance methodAvailable
toString()Instance methodAvailable

Date notes

  • 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.

Error

MemberKindStatus
Error()ConstructorAvailable
messageInstance propertyAvailable
nameInstance propertyAvailable
stackInstance propertyAvailable
toString()Instance methodAvailable
TypeError()ConstructorAvailable
ReferenceError()ConstructorAvailable
SyntaxError()ConstructorAvailable

Error notes

  • 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.

Notes

  • This reflects the current behavior in the interpreter and specs.

Math

Status of the JavaScript Math global object in GiavaScript.

MemberKindStatus
EStatic propertyAvailable
LN10Static propertyAvailable
LN2Static propertyAvailable
LOG10EStatic propertyAvailable
LOG2EStatic propertyAvailable
PIStatic propertyAvailable
SQRT1_2Static propertyAvailable
SQRT2Static propertyAvailable
abs()Static methodAvailable
sqrt()Static methodAvailable
acos()Static methodAvailable
acosh()Static methodAvailable
asin()Static methodAvailable
asinh()Static methodAvailable
atan()Static methodAvailable
atan2()Static methodAvailable
atanh()Static methodAvailable
cbrt()Static methodAvailable
ceil()Static methodAvailable
clz32()Static methodAvailable
cos()Static methodAvailable
cosh()Static methodAvailable
exp()Static methodAvailable
expm1()Static methodAvailable
f16round()Static methodAvailable
floor()Static methodAvailable
fround()Static methodAvailable
hypot()Static methodAvailable
imul()Static methodAvailable
log()Static methodAvailable
log10()Static methodAvailable
log1p()Static methodAvailable
log2()Static methodAvailable
max()Static methodAvailable
min()Static methodAvailable
pow()Static methodAvailable
random()Static methodAvailable
round()Static methodAvailable
sign()Static methodAvailable
sin()Static methodAvailable
sinh()Static methodAvailable
sumPrecise()Static methodAvailable
tan()Static methodAvailable
tanh()Static methodAvailable
trunc()Static methodAvailable

Notes

  • 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.

JSON

Status of the JavaScript JSON global object in GiavaScript.

Static methods

MemberKindStatus
parse()Static methodAvailable
stringify()Static methodAvailable

Notes

  • 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.