TypedArray.prototype.with()
Baseline 2023
Newly available
Since July 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
TypedArray
实例的 with()
方法是使用 括号表示法 更改给定索引的值的 copying 版本。它返回一个新的类型化数组,其中给定索引处的元素替换为给定值。该方法与 Array.prototype.with()
的算法相同。
¥The with()
method of TypedArray
instances is the copying version of using the bracket notation to change the value of a given index. It returns a new typed array with the element at the given index replaced with the given value. This method has the same algorithm as Array.prototype.with()
.
语法
参数
返回值
例外情况
描述
¥Description
详细信息请参见 Array.prototype.with()
。此方法不是通用的,只能在类型化数组实例上调用。
¥See Array.prototype.with()
for more details. This method is not generic and can only be called on typed array instances.
示例
使用 with()
规范
Specification |
---|
ECMAScript Language Specification # sec-%typedarray%.prototype.with |
浏览器兼容性
BCD tables only load in the browser