Javascript

In this session, we learned the usage of Javascript, C, C++, and Java. The C programming language is used for computer programs, while C++ provides coders with imperative and object-oriented features. Javascript is unique because it specializes most in coding interactive effects. To practice with this new type of coding, we used Javascript the most.

On Monday, we first began learning about Javascript, C, C++, and Java. While we used Java, we learned a program called Processing. Processing is a program used to learn and practice with the language of coding, and contains it's own pre-loaded libraries. While we did use Processing for creating programmed art, we used Java for simple practice. Using Processing, we created an image of a smiley face. Here is the code I used:

The face I created using this code is:

Next, we coded a bouncing ball, in order to learn to use variables, conditions and loops. Here is the code:

Here is an image from the coded animation:

Next, we learned about variables and prompts. A prompt shows that the computer is waiting for input. A variable, represented as "ver", is a value that can change. We used both of these things to practice with Javascript, which we began to practice with on Tuesday. I began the code for a small script that I called a "Text Adventure". In this script, the computer would "troll" the user, initiating a maddening game of "guess my secret". The code is in this picture:

Afterwards, I finished the code for the Text Adventure, and I tested it a few times to see if it worked. It did, although it did feel somewhat open-ended.

Later, I tried to code a house using Processing. However, the code would not work for some reason; while an image did pop up when I ran the code, it only showed a blank gray screen. Here is the code I used:

On Wednesday, I used sine and cosine to create an ocillating ball move around the screen. The code used to make this was:

The result itself was:

Reflect

The Javascript session closed my lessons with Computer Science. During Javascript, I learned more about interactive coding, and the ways we can use it. I found the practices fun, helpful, and informative. It indroduced me to a new view of Javascript and it's inner workings, as I had never looked closely at Javascript before this session.

Back to the Table of Contents