Yes, conceptually this is correct. Only you do not call the function, at least not before writing Number to the document.
Btw, Number is a global reference to the Number constructor, so you should use a different variable name, lowercase at best.
var num = 100; function outcome() { num--; } outcome(); document.write(num);
or
<script> var num = 100; function outcome() { num--; alert(num); } </script> <button onclick="outcome()">Decrease!</button>
( Demo on jsfiddle.net )
Bergi source share