//variable non globale (à cause du "var" devant) var a = 666; function disp() { alert(a); //a est undefined } disp(); //variable globale b = 555; function dispB() { alert(b); //affiche 555 } dispB(); //et aussi inversement function doNothing() { c = 12345; } doNothing(); alert(c); // affiche 12345 function doNothingX() { var d = 12345; } doNothingX(); alert(d); // undefined