JavaScript…ouch

This week, I appreciate that our work was broken down into a small increment that was more manageable for me to work through and digest between last week’s class and this week. That being said, I definitely struggled with keeping all of the concepts straight, and I definitely took comfort in the fact that my fellow classmates had difficulty with some parts of the lessons as well.

One thing that confused me, and that I think Codecademy did not do a good job explaining, was some of the small pieces of syntax that got overlooked. Most specifically I believe this case was demonstrated when the syntax switched from regular parentheses to square brackets when writing out arrays — something I didn’t catch initially but only noticed when I worked through the problem for long enough. Things like this are very minute, but obviously make a difference when writing code. I also thought that the amount of knowledge (most specifically lumping in jQuery and JavaScript together) was a lot to comprehend. Even though it makes a lot of sense to learn those two language together, it was very hard for me to digest JavaScript and then jump right into jQuery — a language I don’t think was explained all that well.

One question that I had was about the explanation in Codecademy about generating a random card by using the Math.random and Math.floor functions. I wasn’t sure why you would multiply that function by 4, and where exactly that number and matching “card” came into play. Hopefully Greg will be able to shed some light on this, or hopefully walk us through this example and explain where the multiplication comes into play.

Overall I am looking forward to working through a couple of examples, similar to how we walked through the photo gallery last week, so that the overall structure of some of the jQuery concepts can be explained, and how that integration process works.

1 thought on “JavaScript…ouch

  1. Greg Linch

    Regarding the math functions, here’s the Codecademy explanation for those:

    1. Math.random will generate a random number between 0 and 1.
    2. We then multiplied that number by 50, so now we have a number between 0 and 50.
    3. Then, Math.floor will round the number down to the nearest whole number.
    Reply

Leave a Reply to Greg Linch Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.