Best practice is to define all of the variables that need global scope in your script as a comma separated list at the top of your code as shown in this example. Where you are using functions or objects (which we'll get to in later examples) those variables which are local to the function or object should be defined as a comma separated list at the top of the function or object.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
var hello, world;
hello = 'hello';
world = "world";
document.getElementById('ex').innerHTML = hello + ' ' + world;