Table of Contents
IntroductionKyle Simpson begins the course with a brief overview of what he’ll be covering throughout the course. He also recommends a few books and resources as supplemental sources of learning.
Introduction to ProgrammingWriting code is nothing more than putting words and phrases into a text editor. These words and phrases are specific to the programming language you are writing. Kyle compares code syntax to the grammar of a spoken language.
StatementsA statement is a group of words, numbers and operators that perform a specific task. Most statements end in a semicolon. A computer program is a collection of many statements which carry out the programs purpose.
ExpressionsKyle demonstrates how statements can consist of one or more expression. Expressions can be a reference to a variable, a mathematical operation, or even a function call.
Executing a ProgramStatements and expressions make it easy for developers to tell the program what to do. When it comes time for the computer to execute the code, it needs to be either interpreted or compiled into a language the computer will understand.
Practice CodingKyle stresses that practicing coding the best way to get more comfortable with the syntax. He spends a few minutes talking about how to use the developer console in a web browser.
Input & OutputKyle demonstrates how to use the console.log() statement to output information into the web browser’s console. This statement is used often for displaying the current value of a variable and testing code execution.
Code CommentsComments are code ignored by the browser. They are useful for adding documentation, notes, or any other text to the source code. Comments can be added to a single line or a block of code. Kyle demonstrates how to use both types of comments and offers a few suggested use-cases.
Conditional StatementsOne major use for block statements is with conditions. An “if” statement checks a condition and will execute the code within its block if the condition is true. If the condition checked is only a value, the value will be converted to a Boolean.
LoopsLoops like “for”, “while”, and “do-while” continue to execute a block of code while a condition is true. Kyle starts by demonstrating a “for” loop which uses an iterator to control how many times the loop runs. He then talks about while loops and how the break statement can be used to halt a loops execution.
FunctionsFunctions allow you to create a block of code that can be called at anytime. Functions can also take parameters as input enabling the block of code to run more dynamically. Kyle creates a few different functions and show how to pass parameters and return values.
ScopeA variables scope describes the area of the program where the variable is available. For example, if a variable is defined inside a function, it’s only available within the function’s block. A function does have access to any variable defined outside of it’s block.
Challenge 1In this challenge, you will write a program to calculate the total price of your phone purchase. You will keep purchasing phones until you run out of money.
Challenge 1 SolutionKyle walks through the solution to Challenge 1.
EcmaScript 6While answering a few audience questions, Kyle spends a few minutes talking about how developers can start using ES6 syntax in their applications. He demonstrates Babel and ES6 Fiddle and discusses why learning this new syntax is important.