On Github jeseekia / learn-to-code-javascript
The long def:
The process of taking an algorithm and encoding it into a notation, a programming language, so that it can be executed by a computer.
The short def:
Telling a really dumb item (your computer) what to do.
TODAY:
Me You Computer Browser
AFTER TODAY:
Text editor: Sublime Text 2 Language: Depends on what you want to do
HELLO WORLD
alert(“Hello World”);
console.log("Hello World"); alert("Hello World");
THE TWO BIG SECRETS OF THE PROGRAMMING SOCIETY….
ANYONE CAN DO IT!
NOOB == VETERAN
NOW FOR THE GOOD STUFF!
JavaScript is the programming language for the web.
Whether you choose to pursue frontend or backend development, JavaScript is crucial to know
Provides the functionality or interactivity on most sites today
JavaScript was created by Brendan Eich back in 1995, over the course of 10 days.
It is now one of the most popular languages around.
Programming involves storing and manipulating data.
Programming would not be what it is today if we could not store our data.CONTAINERS FOR DATA
Shoe box example. Clear plastic container. Box holds whatever you want to put in it. Have a box. Know you want to store shoes in box. Label box. Put shoes in the box.var myVariable = “Hello World”; var myName = “Jeseekia”; var myAge = 25; myStudentStatus = true;
CONTAINERS FOR DATA
Initialization: Declare a variable. Declaration: Assign it a value. In that order (together or separately)
var name = value; var myVariable = “Hello World”; var myName = “Jeseekia”; var myAge = 25; myStudentStatus = true;
NOT ALL DATA IS CREATED EQUAL
Any number including floating point, negative, and scientific notation
var myNumber = 4; var myNumber2 = 4e5; var myNumber3 = -4.500;
Either true or false.
var myBoolean = true; var myBoolean2 = false;
A series of one or more characters.
var myString = "Jeseekia"; var myString2 = "@metadevgirl"; var myString3 = "jeseekia@gmail.com";
var myStatement = myName + “is” + myAge + “years old.”;
Concatenation: joining character strings end to end.
JSFIDDLE.NET JavaScript console
ARITHMETIC OPERATORS
Addition + Subtraction - Multiplication * Division / Modulus % Increment ++ Decrement --COMPARISON OPERATORS
Equal to == Equal value and equal type === Not equal != Not equal value or not equal type !== Greater than > Less than < Greater than or equal to >= Less than or equal to <=
LOGICAL OPERATORS
And && Or || Not !Computers (or their programs) make decisions based on conditional logic. A program evaluates a Boolean Expression, or a condition and determines what it should do next.
if (condition) { Statement }
j = 9; if (j<3) { alert("J is less than 3.") }
if (condition1) { Statement1 } else if (condition2) { Statement2 } else { Statement3 }
j = 9; if (j<3) { Statement1 } else if (j=1) { Statement2 } else { Statement3 }
JSFIDDLE.NET JavaScript console
When we want to execute a block of code more than once, we can use a loop. There are many types including:
for ([initialization]; [condition]; [final statement]){ //DO SOMETHING }
for (i=0; i<4; i++){ console.log(i); }
DO NOT RUN THIS CODE
Infinite loops are loops that never evaluate to false and will continue looping indefinitely (until your browser/program crashes.)
for (i=0; i=4; i++){ console.log(myStatement); }
JSFIDDLE.NET JavaScript console
function checkApples(numApples) { if (numApples === perfectNumber) { alert(“You ate the perfect number of apples!”); } else if (numApples > perfectNumber) { alert(“You ate way too many apples.”); } else { alert(“You didn’t eat enough apples.”); } }
checkApples(); //call the checkApples function checkApples(4); //call the checkApples for numApples=4
COMMON PRACTICES/TIPS/RESOURCES
thisIsCamelCasing
Indenting is bulletpointing for code
Create outlined/readible code
For human ease
// This is a JavaScript comment
Keep details for each section in code
Comments aren't read by computer/program
Chrome: Developer Tools in menu
Ask questions or find answers
Codecademy: free
Sign up for CodecademyTreehouse: $25/month
Get 50% off first month for www.teamtreehouse.comGet one!
JESEEKIA
@metadevgirl
jeseekia@gmail.com
www.metadevgirl.comProgramming is the key to telling one of the least intelligent items in the world (your computer) what to do and how. Contrary to popular belief, being a programmer doesn't mean years of grueling work. All you need to start are the basics and a language of choice. We will use JavaScript, a widespread language running in all browsers and most websites active today. JavaScript is a versatile language that is easy to get started in and doesn't require complicated setup to use. With JS we will learn the basics of programming including variables, data types, logic statements, functions, and simple best practices to get you started as a programmer.
Jeseekia Vaughn is a student in Wayne State University’s College of Engineering majoring in Mechanical Engineering. Jeseekia spends time outside of school doing freelance web development and teaching. Jeseekia is interested in combining mechanical system knowledge and mobile app development. She is looking forward to research experiences to serve as a bridge to Ph.D studies. To positively impact diversity in STEM fields, she recently served on the board of directors for the National Society of Black Engineers and is a Co-Organizer/Instructor with Girl Develop It Detroit. In her free time Jeseekia codes and is an avid gamer.