Javascript split function in chrome gives unexpected results

javascript

Solution

Because `name` is a global variable used by chrome, and it’s not possible to override it without unexpected results. Try:

var name = str.split(","); // always use var for local variables!

Problem

Here is the piece of code ``` str = "a,b,c"; name = str.split(","); ``` The `name` variable shows up as 'object' type in Firefox and 'string' type in chrome Why is that happening ? Here is the jsfiddle http://jsfiddle.net/XujYT/17/ Also the `name` variable stores the value `"a,b,c"` instead of the split array in chrome http://jsfiddle.net/XujYT/23/

Original source