However, I do want to continue to share about the progress I am making on the course at code academy.
The next thing I learned about with Javascript is a big one and one which I find quite cool. It is comparisons and if statements. An if statement uses the word "if" and a following statement. If this statement is true, it will run the code in the following curly braces {} An example of this can be seen below.
The above if statement did something if the statement is true. I then learned how to make the computer do something if the statement was instead false. This is done by adding an "else" section. If the statement is not true, it will run the code inside the curly braces after the "else." An example can be seen below.
The next thing I learned on code academy was a bit about debugging. I was given several lines of incorrect code with mistakes in it. This code did not run properly. It was my task to fix the code so that it could run. It took me a bit to see all of the errors but I did get it eventually.
The next new thing which I learned involved the modulo or the "%." When this symbol is placed between two numbers, the computer divides the first number by the second and displays the remainder. To practice this, i was given the simple task of printing out the answers to some questions using a modulo using the console.log function. Some examples of using the modulo are down below.
No comments:
Post a Comment