I am learning javascript and i use jquery framework for some learning…
please can someone explain to me how to use this sample to alert byebye instead of hello
better question will be how to change var msg in function change
var msg = 'hello';
function change() {
msg = 'byebye';
}
alert(msg);
Well, if
change()was invoked before thealert(), it would do what you expect.Try this for instance: