get variable from other javascript file

JavaScript
/* If the variable is of 
(a) global scope and 
(b) in a file loaded Before the one fetching it, 
it should work as usual. */

// Variable in first.js :
var colorCodes = {
  back  : "#fff",
  front : "#888",
  side  : "#369"
};

// Call in second.js :
alert(colorCodes.back); // #fff
Source

Also in JavaScript: