Tuesday, December 26, 2017

JavaScript: Punctuation

Before starting to write more difficult lines of code, I have to know the grammar rules of JavaScript. Grammar, as defined by Douglas Crockford is how the computer language is built and structured (Crockford 5). Because grammar is a large part in the language's structure, I will have to practice in order for me to code efficiently. Additionally, the strength and accuracy of the grammar will directly correspond to the integrity of the code and how it will perform. Having flawless grammar will be challenging to master, but it will become necessary in the future to successfully code.

One of the many forms of punctuation introduced by Crockford is whitespacing. Whitespacing, simply, is having a blank space to separate characters. Crockford mentions that "whitespace is usually insignificant, but is it occasionally necessary to use whitespace..." (Crockford 5). Although Crockford states that whitespace can be more or less unimportant, I find that it makes a significant difference in writing and editing code, since the spaces make it much easier to read. However, I was still hesitant in putting a small space between words.
Code with whitespacing

Code without whitespacing

Making your code easier to read can be extremely beneficial, not only for you, but peers who investigate your code. When something is easy to read and understand, the process for revision and editing becomes significantly less difficult. Again, I was hesitant to go the extra mile for readability, but after having my dad, a software engineer, explain to me how important readability was, I realized how important it could be, and made it into a habit to whitespace consistently. With my newfound knowledge of punctuation, I was able to more code with much more efficiency and clarity, allowing for easy revision and readability.

After a few hours of experimenting with a multitude of grammar and conventions using Crockford's guide, I created a simple visual reference chart for the future as I start learning how to create advanced and complex code. The testing process helped me better understand what to do with some of the conventions. Just as writing helps to reform memory, continuously writing code reinforces my understanding of computer language.


When I finished my attempts to practice and learn the grammar of JavaScript, I had gained more understanding of how and when to use some commands, and what I should type. Additionally, I had learned that the learning process can be extremely slow and difficult, and possibly boring, but it can pay off in the end when you have mastered the contents.

After reading this, would you like to try to learn something difficult? If you have already done so, when have you devoted time and effort into learning something?
Works Cited:
Crockford, Douglas. JavaScript: The Good Parts. O'Reilly Media, Inc., 2008.

2 comments:

  1. Hi William! I've noticed that on the path to getting a job and having a successful career, there are a lot of big obstacles you have to overcome, many of which require putting forth a lot of effort in order to learn something difficult. My sister has had to learn HTML, CSS and JavaScript at college even though she is not going into a computer science related major. It really shows how important it is to set good goals and work hard to achieve them!

    ReplyDelete
  2. Hi Josh! Thank you for taking the time to read my post! I am pretty new to programming, and going through the learning process has made me realize the amount of obstacles that there are. I agree that setting goals can be extremely helpful, and that going small steps at a time will help you succeed later.

    ReplyDelete