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:
- 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.
- 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
typeofoperator 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
- A value is
undefinedif it has been declared but not been defined a value or has been explicitly set to the value
- 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: valuepairs, also commonly referred to as
- 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 help us execute code only when a certain decision or condition exists.
- We use
switchas our tools for this. Each evaluates a condition to
falseand acts accordingly.
- 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
Bringing it all together
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.