Day 7 (week 2) Intro to JS

I’m just going to skip my usual intro of “after the morning announcements…” unless there is something that I think would be helpful to this blog.

Today was a fun day, but perhaps not for the normal reasons. Today we got an introduction to Javascript (JS). Nothing really new here for me. Basic data types and a discussion on “truthy” vs. “falsy.” We also talked briefly about the difference between let and var. I honestly think it’s difficult to understand what the difference is until you learn about scope and start writing larger programs or sharing code with others. Since I’ve done a lot of programming in Python and some C++, scoping is not new to me, but it was nice to listen to the discussion.

I’m really looking forward to doing more work with JS and getting into some back-end programming like writing APIs and coding databases.

The pair programming activity today was to write some basic logic for the classic Rock-Paper-Scissors game. The idea being that we can use some conditional logic to encode the basic rules of the game. I found it useful to consult The Official Rules of Rock Paper Scissors, Section 6.

After finishing the basic example, I decided to go in another direction and code a simple website that would play the game. I started with just the idea of having a button on the page that when pressed would play one round of the game. Both sides were just a random selection from an array containing the three elements: rock, paper, and scissors. This turned out to be pretty easy, so I added some images for the hands, as well as for the outcome of the round.

Everything was in a Github repo as I worked, and you can find the code here. I also pushed the final website to Heroku, and you can play the game here. I still need to clean up the code, as it was kind of slapped together this afternoon. You can see the version in the screenshot below. You can choose whether to play randomly or make a specific choice by using the first radio button group. After pressing the play button, the outcome of the round is displayed, along with whether you won or lost. The numbers below Computer and Me keep a running total of wins for each player. Not too bad for a Tuesday afternoon.

At the end of the day, I had my first career planning meeting. I thought this meeting went really well. We chatted about what kinds of things I was looking for in my new programming job and also what my goals and values are. We put together a list of the materials that I need to assemble over the next week.

Again, I was extremely impressed with the organization and structure of what was offered. I think we developed a good plan for beginning the job search process.