Betwixt Code and Music
The Iron Yard - Day 06
September 02, 2015 —
For instance, let’s assign a value to the variable “name” and put it into an important sentence:
var name = "Mike";
var statement = name + " is really cool";
var name = "Bob";
One would think that the output would be “Bob is really cool”… Nope, it is still “Mike is really cool”. Confused yet? The logic works like this:
- Name holds the value “Mike”
- Statement holds the value “Mike is really cool”
- Name is given a new value of “Bob” which replaces the original of “Mike”
- Statement is asked to show the value it contains, which is still “Mike” - we did not put a new value into Statement
The nightmare mode (which I did not employ) asked the developer to make the quiz adaptive based on the success of the answered questions. I could see how this is possible, but my code would have been MUCH longer to make it work.
Now, I am still working on my HTML forms homework from Monday. I will finish this TODAY!!