x This domain is for sale. If you intrested, Please contact : webspeckle@gmail.com

Access global variable from a function, which has same variable name

How to access global variable from a function, which has same variable name in java script.

You can use the window object to get the global variable.
e.g. window.variableName
Here we write an example
var blogName = "webspeckle";
var blog = function()
{
    var blogName = window.blogName || "";
    return blogName;
}
blog();

//The output is 'webspeckle'


Split a string into an array of strings in JavaScript

Definition and Usage
The split() method is used to split a string into an array of strings.

Syntax
stringObject.split(separator, howmany) 
separator Required.
Specifies the character, regular expression, or substring that is used to determine where to split the string

howmany Optional. Specify how many times split should occur. Must be a numeric value

Note: If an empty string ("") is used as the separator, the string is split between each character.

Sample code and demo is here

Demo