global variable into js

Hi guys I was curious to know 

In Ruby for declare a global variable you do this

$global_variable = somethingbut in Javascript I was curious...How do you declare a global variable? 

you have to use something likes the sames syntax? 

var $global_variable = something;or this totally different...? I was curious to know about this for be honest !

thanks for any further answer!
If what I've been reading is right any variable not included in an object or function is considered a global variable.  Basically if it's not in between { } then it's considered global which is generally discouraged, but when you need a global you need a global.
If what I've been reading is right any variable not included in an object or function is considered a global variable.  Basically if it's not in between { } then it's considered global which is generally discouraged, but when you need a global you need a global.
I see yeah Huddell explained me in private on skype and said to me the "$" sign don't change anything at all and this work like you explainned 

thanks for your answer c:
First its:

var something = value;

I do not like nor do I recommend you use global variables because they can become manipulated and change state very fast. When programming javacript you want to look at something or concepts relating to: immutable js.

This means that you do not have global variables that you can change it means you have scoped variables that you set and when a "new version" comes in it is compared against the current variable and then if there is change you update the state of your app.

having global variables every where is a very bad thing because it means some one else's script could change whats currently in that variable and it could cause issues.
Unfortunately MV codebase is same as Ace when it comes to using global variables.
Unfortunately MV codebase is same as Ace when it comes to using global variables and singleton classes.

this shouldn't stop you from writing your own code that is more protective against the manipulation of global variables and what not. 

Original thread: https://forums.rpgmakerweb.com/threads/global-variable-into-js.44975/