Js split函数给出了错误的结果

Uda*_*try 3 javascript

我试图通过"##"分隔符拆分此字符串.

var historycookie = "8.4707417,77.0463719:Sector 14:Gurgaon##28.3952729,77.3238274:Sector 15:Faridabad";
var history = historycookie.split("##");
alert(history.length);alert(history[0])
Run Code Online (Sandbox Code Playgroud)

history.length警报是给我造成为6理想,但它应该是2,history[0]警惕是给不确定的.请帮助我,因为我无法理解为什么会发生这种情况.

Eyt*_*ibi 10

"历史"(甚至"历史")是由浏览器定义并代表您的历史记录.

history.length; // is returning size of entries in your history
history[0]; // undefined, because it is not an array
Run Code Online (Sandbox Code Playgroud)

只需更改历史记录变量的名称即可.