On this page:
Basic JavaScript Mapping for Sequences
A Slice sequence maps to a native JavaScript array. This means that the Slice-to-JavaScript compiler does not generate a separate named type for a Slice sequence. It also means that you can take advantage of all the inherent functionality offered by JavaScript's array type. For example:
Slice
sequence<Fruit> FruitPlatter;
We can use the FruitPlatter
sequence as shown below:
JavaScript
let platter = [Fruit.Apple]; platter.push(Fruit.Pear);
JavaScript Mapping for Byte Sequences
As an optimization, occurrences of sequence<byte>
map to a Uint8Array type, which is more efficient than native arrays for working with binary data.