Days -2..<1 Pre-Bootcamp Algorithms

The Friday morning before the bootcamp (day -2, I suppose), I hopped on to the learning platform to check out what work I was supposed to get done before the bootcamp began. To my surprise, I found four whole chapters of algorithm problems! I thought to myself, “Oh shit, I’m supposed to do all of this before the bootcamp starts? How did I miss this until now?” I immediately got started. Turns out the algorithm challenges were not that challenging after all, but there were a lot of them. Over the course of Friday, Saturday, and most of Sunday, I was writing algorithms non-stop in Javascript. In the end the count got up to 102, and they are now all on my GitHub if anyone wants to check them out. Though I was in a rush so they don’t have descriptions commented onto them yet, lol.

After writing all these basic algorithms in Javascript, I am becoming aware of some major differences between Swift and Javascript.

In Swift, everything is explicitly typed. You need to declare a type for whatever variables you’re setting, along with types for return values and so on. In Javascript, you just make variables and put whatever you want in there. Javascript will just figure it out and switch types on the fly if it needs to.

In Swift, once an array has a certain type of value that it contains, it can only have that type of value. In Javascript, you can just put whatever you want in any array.

Syntax in Javascript is somewhat similar to swift in that you open and close code blocks with curly brackets, but in Javascript all statements for loops and conditionals and whatnot need to be contained in parentheses. Javascript also uses semi-colons at the end of lines of code, whereas Swift does not.

Anyways, these were just a few of the major differences that jumped out at me when I started using Javascript. I’m sure I’ll notice more differences as I use it more.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s