Maintaining var when another scene is loaded(JS)

Ok so I have a character that has a money and score variable that I would like to keep the same value when I load another level/scene. Whenever I load the character the values revert back to their origonal defaut settings of zero. Is there any way to maintain the score/money variable when I change levels? If whoever answers this could use JS that would be really helpful.

Static variables will persist through scenes:

static var test : int = 0;

Just remember that the variable will be shared between all instances of the script

You can also look into PlayerPrefs for keeping such info of your player.