推送到数组时发生意外行为

时间:2018-09-14 01:04:12

标签: javascript

我正在创建一个内部数组如下的空数组:

SELECT 
    VIN_NUM AS [Registration VIN]
    ,REGION_IND AS [Location of Registration]
    ,REG_CHANGE AS [Changed Location Since Last Check]
    ,CASE 
        WHEN REG_CHANGE = '' THEN REGION_IND 
        ELSE REG_CHANGE 
    END AS [Final Location]
FROM
    dbo.All_Tests
WHERE
VIN_NUM LIKE '1FM%' AND
CASE 
    WHEN REGION_IND = '1' THEN 'Upstate'
    WHEN REGION_IND = '2' THEN 'Downstate'
    ELSE 'Unknown' 
END = 'Downstate'

然后在0到SIZE之间的某些索引上尝试:

myVar = new Array(SIZE).fill([])

并发现数组的每个索引都填充了“某个值”,而我希望可以填充所指示的索引。

为什么我会出现这种情况?有什么办法可以改变吗?

0 个答案:

没有答案