Showing posts with label Technology. Show all posts
Showing posts with label Technology. Show all posts

Thursday, November 30, 2017

JavaScript: Introduction

William Nguyen

JavaScript: The Good Parts, Douglas Crockford

Programming can often be seen as extremely difficult and time consuming to learn. This is not always the case, as it can easily be learned by anyone who simply devotes their time and effort. Learning a computer language can be extremely beneficial for those who are interested in a path down the quickly-growing technology field, as the pay and demand for experienced programmers are extremely high.

There are a vast amount of programming languages that are available to learners, each with their own purpose, such as C++, C#, Python, etc. However, I will be focusing on JavaScript, one of the most demanded languages in the job industry.

What exactly is JavaScript? JavaScript is the primary language that web browsers use, making it one of the most popular programming languages in the world (Crockford 2). This means it can be used to create web interactive elements such as text, or create complex applications and programs. In my practice to eventually master the language, I have chosen to create a simple program that responds with text based on whether a given statement is true or false. To create this program, I first need to obtain a console, which is a text-only interface that runs computer languages. Luckily, there are a multitude of consoles readily available on the internet, some with helpful guides, which I found out about when I started to learn how to program.
SoloLearn, the console I am using


After I found my console, I started to play with some of the code and test some different functions, seeing how JavaScript worked. As it turned out, many of my statements had mistakes, making it impossible for them to execute properly.  I found that it is necessary and extremely important to have good syntax when programming if you want your code to function. From this, I realized that I was essentially "speaking to the computer", and similarly to real life situations, if you do not communicate clearly, the person will not be able to do the job properly.


Syntax errors in red

 
The correct output

I made a significant amount of mistakes, but even the smallest error can make a huge impact on the how the code runs. In addition, errors can cost us large amounts of time to fix. "The sooner we can detect and repair errors, the less they cost us. JavaScript is a loosely typed language..." (Crockford 3). This means that JavaScript's software is unforgiving when it comes to mistakes, and this shows that in order to not waste precious time finding/fixing mistakes, we need to construct code accurately the first time. I noticed that I was constantly making mistakes by overlooking the minuscule details. After realizing what I was doing wrong, I was able to change the way I wrote code. Instead of typing and moving onto the next line without looking back, I made sure to double-check my work for syntax errors. This was extremely effective, as it became a helpful habit.


Code working properly!
Close-up of edited code

Practicing to master my new technique took quite a bit of trial and error, but as a result, my code was working much more often!




Question: Have you ever tried or thought about starting to learn how to code? If so, what are your thoughts on the learning process, and if not, what is your opinion on  starting to learn something                                                                  completely new?  


Works Cited:
Crockford, Douglas. JavaScript: The Good Parts. O'Reilly Media, Inc., 2008.