This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1. Variables are sort of metaphorically like defining a character | |
//with whom your program, the author, is going to play. Variables | |
//are for storing the definition of something in memory. When you | |
//declare a variable you are basically creating a tool for your | |
//program to hold on to and be able to work with, and naming that tool. | |
//They can be many different types of things, including a number, a string, | |
//a boolean, a function, etc. They're called variable because they are | |
//changeable throughout the program. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//II. Datatypes (Simple & Complex) | |
//Javascript has many data types that can be used in variables. These are, as they sound, | |
//types of data that are recognized by the interpreter as data. Below are some of the data | |
//types described. | |
//1. Number | |
//A number in javascript is, well, a number. It is declared using straight up integers or | |
//integers with decimal places, declared with a "." then the remaining part of the number, | |
//up to 15 decimal places. Each number is stored in 64 bits of memory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Control Flow | |
//Control flow is exactly what it sounds likes--exercising control over | |
//the flow of one's program, and there are many tactics toward this end. Two conditional | |
//tactics are outlined below, if statements and switch statements. | |
//The if-else and if statements incorporate block statements with different conditions | |
//that, if met or not met, determine how the program moves forward. See below. | |
var brendansBoss = function(trait, goodnessLevel) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Functions: programs within programs! | |
//Functions are the internal combustion if variables are the fuel. Functions are the trebuchets, if variables are the boulders. | |
//Enough metaphors. Functions are the action in a program that keeps the program moving along, they are what gets executed. | |
//The two necessary phases of a function are declaring it, and executing it--also calling a function or invoking a function. | |
//To declare a function there are a couple ways. | |
var scrumtrelescent = function(para1, para2) {} | |
function scrumtrelescence(para1, para2) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Loops: While, for, for-in | |
//Loops are a great way to access, manipulate, output or otherwise deal with | |
//a set of information in different ways. There are different types of loops | |
//that are ideal for accessing different things. | |
//A for loop loops through a block of code a certain number of times. | |
for(i = 0; i <= 5; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//JAVASCRIPT OPERATORS UNITE | |
//Operators are sort of like the prepositions of javascript. They express a | |
//relation of one thing to another, often a variable to another variable, or they | |
//facilitate a definition. Let's take a look below at some specific operator definitions | |
//and their examples. | |
//1. Assignment | |
//Assignment operators do what their name says--they assign a meaning, definition or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//String Manipulation | |
//Strings are essentially characters (or a lack of characters) put inside of quotes. They can | |
//be viewed essentially as "display-only", if you will, in that they don't contain a value | |
//that is represented by what they look like. In other words, a string could be | |
//"This string is the number six", but it would not be. The string would be, simply, that | |
//series of characters in that order. They can be manipulated in many ways, outlined below. | |
//SOMEthing to keep in mind while looking at all of the below is that strings are immutable, which means | |
//they cannot be changed. Any of the manipulations you may perform to it--slice, turn into array, etc, these |