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