javascript 0.3.0

A JavaScript engine implementation in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
// feature probe for 'BigInt'
try {
  // Try BigInt literal and constructor
  let a = 1n;
  if (typeof a !== 'bigint') throw new Error('BigInt literal failed');
  let b = BigInt(2);
  if (typeof b !== 'bigint') throw new Error('BigInt constructor failed');
  // Basic arithmetic
  if (a + b !== 3n) throw new Error('BigInt arithmetic failed');
  console.log('OK');
} catch (e) {
  console.log('NO. reason:', e.message);
}