Code: Select all
var str
function display()
{
setStr()
document.write(str)
}
function setStr()
{
str = "hello world"
}Why is it that str is not updated before document.write() is called?
Moderator: General Moderators
Code: Select all
var str
function display()
{
setStr()
document.write(str)
}
function setStr()
{
str = "hello world"
}