JavaScript |类型Darray。例句

这个 达雷。of() 是JavaScript中的一个内置函数,用于构造具有可变参数数的新typedArray。 语法:

null
TypedArray.of(element0, element1, ......)

参数: 它接受将要创建Darray类型的不同元素的参数。

返回值: 它返回新的typedArray实例。

显示此函数工作的JavaScript代码:

<script>
// Printing the new typedArray with the given elements with
// the parameters of typedArray.of() function.
document.write(Uint8Array.of(5, 9, 1, 0, 45, 2) + "<br>" );
document.write(Uint8Array.of(22, 9, 1, 20) + "<br>" );
document.write(Uint8Array.of(5, 9, 0, 3, 1) + "<br>" );
document.write(Uint8Array.of(undefined) + "<br>" );
</script>


输出:

5, 9, 1, 0, 45, 2
22, 9, 1, 20
5, 9, 0, 3, 1
0
© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享