I have refereed this question and worked for me: so q1
Now Issue is that I have used JSON.stringify & JSON.parse to store array in localStorage. But when I run the
var myString = JSON.parse(localStorage['bankpro']);
JSON.parse
returns a javascript object, not a string, which would not have a split
method.
If you store an Array in LocalStorage using JSON.stringify, then you get it back using JSON.parse, return value is Array, not string. So when you are using function mySplitResult for myString (which is actually Array, thanks to JSON.parse), then it leads to an Error. So remove function mySplitResult and it should work fine.