Saturday, 17 August 2013

TypeError: string is null

TypeError: string is null

I am getting type error string is null,
i am checking string like this:
if (typeof s != 'undefined' || s.length){
var j = JSON.stringify(
s.split(',').reduce(function(m,v) {
var t = v.split(':');
m[t[0]] = t[1];
return m;
}, {})
);
}
But still it shows type error, tell me how to not run this function on null ?

No comments:

Post a Comment