I was trying to split this string through "##" delimitter.
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])
The history.length alert is giving me result as 6.
But ideally it should be 2.
The history[0] alert is giving undefined. Please help me with this as I am not able to get why this is happening.
"History" (or even "history") is a defined by the browser and representing your history.
history.length; // is returning size of entries in your history
history[0]; // undefined, because it is not an array
Just change the name of the history variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With