mirror of
https://github.com/luzhisheng/js_reverse.git
synced 2025-04-19 18:24:51 +08:00
29 lines
818 B
JavaScript
29 lines
818 B
JavaScript
// 定义一个空数组
|
|
// let mousePos = [];
|
|
// 定义一个空数组
|
|
let mousePos = new Array();
|
|
|
|
// 向数组添加元素 output
|
|
mousePos.push([100, 50, 1586998787]);
|
|
console.log(mousePos);
|
|
|
|
// 删除并返回一个元素
|
|
console.log(mousePos.pop());
|
|
|
|
// 数组转字符串
|
|
let mousePos1 = new Array();
|
|
mousePos1.push([100, 50, 1586998787]);
|
|
mousePos1.push([101, 50, 1586998787]);
|
|
mousePos1.push([102, 50, 1586998787]);
|
|
mousePos1.push([103, 50, 1586998787]);
|
|
mousePos1.push([104, 50, 1586998787]);
|
|
console.log(mousePos1.join(","));
|
|
|
|
// 数组转字符串-2
|
|
let mousePos2 = new Array();
|
|
mousePos2.push([100, 50, 1586998787]);
|
|
mousePos2.push([101, 50, 1586998787]);
|
|
mousePos2.push([102, 50, 1586998787]);
|
|
mousePos2.push([103, 50, 1586998787]);
|
|
mousePos2.push([104, 50, 1586998787]);
|
|
console.log(mousePos2.join(",")); |