In Javascript the scope of variables depends on the reserved word var.
If a variable is created without that word it will be global, otherwise local.
Ex.:
function setNome1(nome) {
  nome_usuario = nome; // nome_usuario foi criada no escopo global
}
function setNome2(nome) {
  var nome_usuario = nome; // nome_usuario foi criada no escopo local
}
setNome1('lucas');
alert(nome_usuario); // lucas
setNome2('felipe');
alert(nome_usuario); // lucas
In the same way that functions can create variables in the global scope, it is possible to access them.
Ex.:
var nome = 'matheus';
function getNome() {
    // A variável nome não existe neste escopo.
    // O interpretador irá buscar em no escopo do qual essa
    // função foi definida. Caso não exista, irá buscar no
    // escopo superior, e assim por diante.
    // Caso a variável não exista será lançado um erro
    // ReferenceError: nome is not defined
    //
    return nome; // 'matheus'
}
alert(getNome()); // 'matheus'
Any function can also change the value of a variable defined in the scope of which it was defined, or at the top.
Ex.:
var nome_usuario = 'douglas';
function setNome(nome) {
    nome_usuario = nome;
}
alert(nome_usuario); // douglas
setNome('emilia');
alert(nome_usuario); // emilia
							
							
						 
you can return or use the global.
– Brumazzi DB
What you call exporting?
– Maniero
He came in the middle of it here: http://answall.com/questions/114377/como-account-attributed-a-um-element-que-foi-creature-com-javascript/114407?noredirect=1#comment238687_114407
– Daniel Omine