Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //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
Advertisement
Add Comment
Please, Sign In to add comment