use*_*629 2 javascript jquery multidimensional-array handsontable
我正在使用handontable,但我不了解JavaScript.我有:
$container.handsontable({
startRows: 8,
startCols: 6,
rowHeaders: true,
colHeaders: true,
minSpareRows: 1,
contextMenu: true,
afterChange: function (change, source) {
if (source === 'loadData') {
console.log(change);
}
Run Code Online (Sandbox Code Playgroud)
当我在控制台中查看时,我看到:
[[4, "notes", "PLEASE SET", ""]]
Run Code Online (Sandbox Code Playgroud)
这看起来不像标准对象.它是什么以及如何访问其参数?
这是一个数组,其中第一个元素是包含4个元素的数组.
var arr = [[4, "notes", "PLEASE SET", ""]]; // Initialize the array
console.log (arr[0]); // [4, "notes", "PLEASE SET", ""]
console.log (arr[0][0]); // 4
console.log (arr[0][1]); // "notes"
console.log (arr[0][2]); // "PLEASE SET"
console.log (arr[0][3]); // ""
console.log (arr[0][4]); // undefined
console.log (arr[1]); // undefined
console.log (arr[1][0]); // undefined
Run Code Online (Sandbox Code Playgroud)