This document is an introduction to JavaScript presented by Jamal O'Garro of Code Crew. It covers the basics of JavaScript including data types, operators, variables, functions, objects, and the DOM. It also discusses more advanced topics like object-oriented JavaScript, prototypal inheritance, AJAX, APIs, frameworks, and Node.js. The goal is to provide an overview of the core concepts and capabilities of the JavaScript programming language.
1. CODE CREW | INTRO TO JAVASCRIPT
INTRO TO
JAVASCRIPT
Jamal O’Garro
Code Crew
Software Engineer + Instructor
2. CODE CREW | INTRO TO JAVASCRIPT
JAVASCRIPT
• Is a programming language
• Created by Netscape
• Runs in browser & server
• Java is not JavaScript!
• Is actually named
ECMAScript
3. CODE CREW | INTRO TO JAVASCRIPT
WHAT DOES JAVASCRIPT LOOK LIKE?
7. CODE CREW | INTRO TO JAVASCRIPT
UNDEFINED vs. NULL
• Both represent absence of a value
• If a variable has not been initialized it is “undefined”
• Null is used to initialize or empty a variable
8. CODE CREW | INTRO TO JAVASCRIPT
IF / ELSE STATEMENTS
12. CODE CREW | INTRO TO JAVASCRIPT
MORE ABOUT FUNCTIONS
• Function declarations
• Function expressions
• Functions and scope
• Anonymous functions vs named functions
14. CODE CREW | INTRO TO JAVASCRIPT
MORE ABOUT OBJECTS
• There are several ways to create objects
• If a variable is part of an object is called a property
• If a function is part of an object it is called a method
16. CODE CREW | INTRO TO JAVASCRIPT
OBJECT-ORIENTED JAVASCRIPT
17. CODE CREW | INTRO TO JAVASCRIPT
PROTOTYPAL INHERITANCE
• JavaScript uses objects for inheritance
• Objects are linked to each other by a special
prototype object
• If we create a new instance of an object using a
constructor the new object “inherits” the properties
and methods of the parent
18. CODE CREW | INTRO TO JAVASCRIPT
CONSTRUCTOR FUNCTIONS
Allow us to create new instances of objects
19. CODE CREW | INTRO TO JAVASCRIPT
THIS
• When a function is called as a method of an object,
“this” is set to the object the method is called on
• If we use “this” with a constructor function it refers to
the new object being created
• If “this” is called outside of the context of a function it
will refer to the global object