Friday, March 20, 2015

Code Academy

Since the start of this project I have had some time to play around with Javascript. I've started an online program at code academy (Link here http://www.codecademy.com/en/tracks/javascript).

The program is working very good for me as it gives you a concept, explains it then gives you a small little project to affirm your understanding.

The first thing I learned was about the .length function. This will tell you how many letters are in a word or phrase. For example if I wanted to know how many letters are in the word "Jordan" I could input "Jordan".length and it will output "6."

Next I learned how to do basic math functions with Javascript. Addition, subtraction, multiplication and division can be easily done with the +, -, * and / signs respectively. For example if I want to perform the function 2 plus 5, I simple type "2 + 5" (note the spacing), and the answer "7" is produced.

Next I learned how to make comments on the code within the actual body of the code. This is useful either to keep organized or to help other people reading your code. To make a comment in your code, start your line with "//" then anything you type after that wont be added into your code.

Next I learned how to make confirmation messages. This will bring up a popup window when executed where you either have the options to press "Ok" or "Cancel". You can do this by using the confirm command. See example below of the code I wrote and the confirm message that pops up.



These can be used to confirm things with users for example, to make sure they don't accidentally delete important things. 

Next I learned about prompts. These commands bring up a dialogue box which the user can enter information into. Here is an example of the code and the prompt dialogue box.


Next I learned about different date types: numbers and strings. Numbers are just quantities used to do things like math. Strings are sequences of characters with the letters a-z, numbers and spaces. To make a number in your code just write the number without quotes and to make a string write your phrase in quotes. An example of a string is "Pizza is good"

Next I learned about a different data type called booleans. A boolean is either true or false. The example code academy gives is using booleans to compare two numbers. 7 > 5 would come out as "true". Here is another example using both booleans and the .length function.

Next I learned how to do the console.log function. This is also commonly called printing out. Whatever you put in the brackets of console.log() will be displayed. here are two examples of work I did with code academy.


Finally, the last thing I learned about for this post was comparisons. Using all the different aspects of javascript I have learned so far, I can compare different things using the commands below (picture from code academy)
Using these, you can compare many things and get a true or false response. Here is before and after pictures of the assignment I did on Code academy.


As you can see I've gotten a pretty good start on my learning of Javascript and I will continue to learn more as I progress throughout the code academy program. 

3 comments:

  1. That's some pretty complicated stuff Jordan, I'm impressed with the progress you've made at this point. Any reasons for learning java script as opposed to any of the other programming languages?

    ReplyDelete
  2. I tried to start learning something like this last summer but I gave up because it was so difficult! It's great to see that you're making good progress. One day when I'm a filthy rich guy, I'll start a huge company (maybe for some sort of energy production) and I'll be sure that you're the head software engineer, earning $1,000,000 a year . How's that for motivation??? Kidding, but what sort of project are you planning on doing with this knowledge?

    ReplyDelete
  3. As Devon and Baher commented, your progess is impressive. I've been looking forward to further updates, but it has been some time without a post. The visuals are very helpful, and you've effectively broken up the text and supported your explanations with the pictures.

    Instead of typing the url for Code Academy, you should create a link to the webite so that readers can click and go.

    ReplyDelete