#Javascript Intro
#What the Week Looks Like
- Intro to JavaScript
- DOM Manipulation
- Object Oriented JavaScript
- EventLoop
- jQuery
- AJAX
- MVC in JavaScript
- Testing!
#Lecture Overview
-
Prepare for Javascript Challenge
-
Where to put it
-
Debugging
-
What's different?
-
JavaScript Types
-
It's All Event Driven - Event Handlers
-
'use strict';
#Prepare for Javascript Challenge
#Where to put it?
- HTML SCRIPT Tag
- Separate Files
#Debugging
- Chrome Dev Tools ALL THE TIME
debugger
#What's different?
var
to declare a variablefunction
to begin a function definition{
this is a block}
- a statement is ended with
;
(
an expression)
- Loops:
for(var i=0 ; i < 10; i++){}
this
kind of likeself
- Gotchas
function
s are first class- No Block Scope - Only Function Scope
==
uses type coersion! So always use===
- Chart Here: http://zero.milosz.ca/
#JavaScript Types *JavaScript Primitive (literal) Values
- String
- Boolean
- Undefined
- Null
- Number
*Javascript Reference Types
- Object
- Array
- Function
- Date
- RegExp
#It's All Event Driven
- Understand Function references
- Attach functions as Event Handler Callbacks
window.addEventListener('load', callback, false);
document.getElementById('mybutton').addEventListener('click', callback, false);
document.querySelector('#mybutton').addEventListener('click', callback, false);
document.querySelectorAll('button')[0].addEventListener('click', callback, false);
#Pro Tips
- Differences between javascript and ruby
- Always have devtools open
'use strict';
- Use jsbin for testing and sharing
#Resources