how to add a variable in alert javascript code example Example: javascript alert variable var text = "hello world"; alert(text);