JS โ†’ AssemblyScript ๐Ÿ”ฎ

Turn your dynamic JavaScript into strictly-typed WebAssembly-ready code.

๐Ÿ˜Ž
JSJavaScript8 ln ยท 139 ch
1 2 3 4 5 6 7 8
ASAssemblyScript8 ln
1 2 3 4 5 6 7 8
function add(a: i32, b: i32): i32 {
  return a + b;
}
const nums: i32[] = [1, 2, 3];
let total: i32 = 0;
for (let i: i32 = 0; i < nums.length; i++) {
  total += nums[i];
}
Applied types to 1 function(s), 2 param type(s), 1 variable type(s), 1 array type(s).
โœ…Typed 2 param(s) in add() (defaulted to i32).
โš ๏ธGuessed return type i32 for add() โ€” verify.
โœ…Typed array nums as i32[].
๐Ÿ’กnums: consider StaticArray for fixed-size speed.
โœ…Typed total as i32.
โœ…Typed loop counter i as i32.
๐ŸŽ“Use `StaticArray<T>` for fixed-size, faster-than-Array collections.