Skip to main content

Release 0.1

The past few weeks I have been looking at the differences between declaring variables for JavaScript.

Var, Const, Let are the variable declarations that are widely used, each one having a specific purpose. New developers mostly use 'var,' as it is the first technique taught.

However, 'var' declarations is no longer widely used by JavaScript developers. The modern practice of variable declarations is with 'const' and 'let'.

Before starting anything, I had to first understand the difference between the three:
  • Const declarations means the values cannot be changed/reassigned. 
  • Let declarations should be used when declaring local variables in a block scope. 
  • Var declarations hold the weakest signal which can be used outside of a block, and can be reassigned.
For Release 0.1, we were asked to look into a library called 'filer.js.' The task was to go through one of the test files, and change the old-fashioned 'var' declarations to the modern 'const/let' declarations. The task was to fork the GitHub library and create a new branch to make changes to. After that, we were required to create a pull request to make the changes to the 'filer.js' master branch

My Issue: https://github.com/filerjs/filer/issues/728
My Pull-Request: https://github.com/filerjs/filer/pull/730

The file I explored was 'filer/tests/spec/fs.shell.spec.js.' The file contained only 'var' declarations, and needed to be updated to the modern format of 'const/let.' The first step I took was to fork the library to my own GitHub account. After that, I opened Terminal and pulled the repository to my local machine. I created a new branch in the new forked repository, and was ready to make changes. Through Visual Studio Code, I edited the 'fs.shell.spec' file and added it to the git files ready to be pushed. After pushing the files to the repository, I created a pull request to the original filer.js library.

Upon completing my own task, I went into all of the pull requests made by my peers. Most of my peers correctly changed the variable declarations, but I found one that had some issues.

Reviewed Pull-Request: https://github.com/filerjs/filer/pull/729

This pull request declared all of the variables with 'let' which according to the articles I read, was wrong. The variables should have all used 'const,' as the variables did not change values. Some examples of the code:


Upon finding these errors, I commented a message to let my peer know to change it.



Other peers have already been reviewed, and this issue was the only one left that had errors.



Comments

Popular posts from this blog

Release 0.3 - Final

For this release (0.3), I worked on an RPG game that uses the JavaScript React component. The goal was to implement a feature which tracked stats into global variables. PR:  https://github.com/ASteinheiser/react-rpg.com/pull/72 This task was actually harder than I anticipated, because of the tedious task of searching through the code to find what you are looking for. For example: It took a long time in order to find the monster names that are being killed, because I don't know where the original developer had placed those variables. Figuring out how to store a global variable and be able to change those values were a medium-level challenge, as it was the first time I stored all of the global variables in a different file. I was confused on how to change those values, and use it in other files.

Release 0.4 Update

For this last Release (0.4), I have found an issue for a rock-paper-scissors game. As JavaScript is my favourite language, I have decided to find another issue that uses the language. For this issue, the problem is that there is currently no Refresh button for this game, so the stats remain the same throughout. Issue:  https://github.com/golemheavy/RPS-Multiplayer/issues/14

Release 0.4 Final

This month had been extremely busy for all of us, especially since BTS630 (Major Project Implementation) required a lot of our focus as well. For this release, I had to create a restart / refresh button that resets the stats of the game (wins, losses, ties). Comparatively to Release 0.3, I did not manage to find a very big issue. But I still found an issue that was bigger than the issues of Release 0.2, and big enough for this Release (0.4). For this release, I implemented the Refresh button, and managed to fix a few of the bugs as well. The Refresh button now changes all the stats back to 0. The bug I found was that the player choice was always 'null,' and the computer choice did not change. Now, the player choice is changed so that it correctly shows the player input, and the computer choice changes randomly every time a new choice has been made. This course was overall very fun and different to the other required courses of the BSD program. I enjoyed it quite well and ho...