I am trying to work out why I am getting undefined data type on printName(). So how we can update a global variable trough a function (like a Setter) function and get access the updated value via other functions if needed.
$(function () {
var name;
function setName() {
name = "TestName";
}
function printName() {
alert(name);
}
printName();
});
setNamefunction.