JS move()

🌙
手机阅读
本文目录结构

已废弃 Gecko 34 (Firefox 34 / Thunderbird 34 / SeaMonkey 2.31)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

**move()**方法将数组中的元素序列复制到以target起始的位置。但是,这个非标准方法已经被TypedArray.prototype.copyWithin() 标准方法取代。TypedArray 是这里的 类型化数组类型 之一。

语法

typedarray.move(start, end, target)

参数

start

源起始位置的下标,在这里开始复制元素。

end

源终止位置的下标,在这里停止复制元素。

target

目标起始位置的下标,复制元素到这里。

返回值

修改后的类型化数组。

示例

使用 move 方法

var buffer = new ArrayBuffer(8);
var uint8 = new Uint8Array(buffer);
uint8.set([1,2,3]);
console.log(uint8); // Uint8Array [ 1, 2, 3, 0, 0, 0, 0, 0 ]
uint8.move(0,3,3);
console.log(uint8); // Uint8Array [ 1, 2, 3, 1, 2, 3, 0, 0 ]

规范

 并不是标准的一部分。由 TypedArray.prototype.copyWithin()取代。

浏览器兼容性

We’re converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven’t yet converted the data it contains.

  • Desktop
  • Mobile
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 未实现 未实现 [1] 未实现 未实现 未实现
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 未实现 未实现 未实现 未实现 未实现

[1] 假设只在 Firefox 16 到 34 的 Aurora 和 Nightly 版本中。

另见

AXIHE / 精选资源

浏览全部教程

面试题

学习网站

前端培训
自己甄别

前端书籍

关于朱安邦

我叫 朱安邦,阿西河的站长,在杭州。

以前是一名平面设计师,后来开始接接触前端开发,主要研究前端技术中的JS方向。

业余时间我喜欢分享和交流自己的技术,欢迎大家关注我的 Bilibili

关注我: Github / 知乎

于2021年离开前端领域,目前重心放在研究区块链上面了

我叫朱安邦,阿西河的站长

目前在杭州从事区块链周边的开发工作,机械专业,以前从事平面设计工作。

2014年底脱产在老家自学6个月的前端技术,自学期间几乎从未出过家门,最终找到了满意的前端工作。更多>

于2021年离开前端领域,目前从事区块链方面工作了