JavaScript Foundations Review

Today we want to reflect on just how far we've already come. Seeing your progress is really helpful to building up confidence and help align a path forward. Here's what we learned so far:

Basics

  • We use statements, which are made up of expressions, to perform a specific task.
  • We use variables to store and retrieve values. We give our variables meaningful names to make it easy for other people to understand what our code does. We follow camel casing conventions.
  • We use comments for explaining things in our code. They will help remind us later what we were doing, and are extremely beneficial for others trying to figure out what’s going on.
  • We use operators to perform actions on variables or values.

Types

  • Programming languages have built-in data structures. These representation of values are known as types. Since JS is a dynamically typed language, types are determined automatically.
  • We use the typeof operator to see the type of something.
  • We use Strings to represent text. String values are surrounded with quotes.
  • A Number is anything 0–9 and also the value NaN, which ironically stands for ‘Not a Number.’ Numbers do not have quotes around them.
  • A Boolean is used to represent true and false.
  • A value is undefined if it has been declared but not been defined a value or has been explicitly set to the value undefined.
  • Null is an assignment value. It can be assigned to a variable as a representation of no value. The caveat: it is actually of the type ‘object’.
  • Object has subtypes of array, object, and function.
  • Objects are much like variables in that they are like containers for data values. The difference with objects is that they can contain multiple values, and are written as name: value pairs, also commonly referred to as key: value.
  • An array is an object that holds values in numerically indexed positions.
  • A function is a block of code designed to perform a particular task, and is executed when “something” invokes it, also known as calling it. Functions help us to minimize our code and avoid repeating ourselves.

Conditionals

  • Conditionals help us execute code only when a certain decision or condition exists.
  • We use if, else, if...else, and switch as our tools for this. Each evaluates a condition to true or false and acts accordingly.

Loops

  • Loops are used to execute a block of code a number of times and are handy if you want to run the same code over and over again, each time with a different value.
  • Our tools are for, for...in, while, do...while.

Bringing it all together

We have both executed all our new skills with the FizzBuzz exercise, and learned a brief history of JavaScript. With this reflection we can see just how much we've learned in only a couple of weeks. We are building a very strong foundation in not just JS, but also programming in general. We hope you've enjoyed things thus far and plan to continue on with us. Great work everybody! If things aren't quite clicking, just keep practicing. You'll get it!

Remember, programming is not just about writing code. It is more a way of thinking. A good programmer will spend time planning and designing on paper before writing any code. She will also be determined and persevere through trials and tribulation. If you ever find yourself struggling, take a walk and let the mind reset. The ideas will flow, and you'll come back with a whole new solution to the problem.

Be sure to utilize other resources, and do some research of your own. Team Treehouse is a phenomenal site for learning web development skills. The team there is great! Stack Overflow is possibly the most popular forum on the internet for developers like yourself. Almost any development question one googles will have a reply on there. Just be careful to take it with a grain of salt.

Keep an eye out for hoisting and scope this week, and feel free to read ahead.

Cheers!