Principle of Programming
Jul 27, 2017 · 1 min read
Some notes I wrote while going thru principle of programming lab using Javascript
<!-- onload when website load it will do something --><body onload="">// JavaScript Document// when you don't assign value output: Nullvar myScore;// set up and change game scoreinit();// invoke the functionchangeScore();// function to initialize game scorefunction init() {myScore = 1000;}// function to change the score of the gamefunction changeScore() {// when myScore initially set to nothing is it NULL// before we run the init() function therefore, output// is NaN when running this function w/o running init()myScore = myScore + 100;console.log("Player score: " + myScore);}
