Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

JavaScript for Developers

Everything about JavaScript, in like an hour.
by

Scott Rippey

on 14 March 2014

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of JavaScript for Developers

JavaScript
for Developers
What my friends think I do
"The Client"
Acquaintances
Designers
Front End Development
CSS
HTML
3 Simple Types
Boolean
Number
String
"Hello World" == 'Hello' + ' World'
3 Objects
Array
var items = [ "one", "two", "three"];
Object
Function
.push(val) .pop()
.unshift(val) .shift()
.splice(index, remove, insert)
JavaScript
Gotchas
Truthy
JavaScript starts here
undefined
or
null?
Scopes
Closures
if there's time, WAT?
Prototype
How to Survive
JavaScript
var items = [ 1, "two", [ 3, 4, 5 ] ];
+ =
...
Java Developers
+ =
What I think I do:
What I actually do:
Bracket Notation
var o = {
"theseQuotesAre": "optional",
"these aren't optional!": "because ' and !"
};
o["youCanAssignAnyProperty"] = 4;
o["these aren't optional"] === "because ' and !";

var dynamic = "youCanAssignAnyProperty";
o[dynamic] === 4;
Dot Notation
var o = {
property1: 1,
propertiesCanHold: "any value",
nestedObjects: {
are: [ "e", "a", "s", "y" ]
}
};
o.youCanAssignAnyProperty = 4;
Object methods
var o = { Scott: "Rippey" };

Existance: ("Scott" in o) === true;
Removal: delete o.Scott;
Non existing: o.SCOTT === undefned;
Iterating: for (var property in o) {
var value = o[property];
. . .
}
Anonymous
var anonymousFunction = function() {
console.log("anonymous function");
};
function namedFunction() {
console.log("named function");
}
Arguments
function canAcceptAnyArgs(arg1, arg2) {
if (arguments.length === 1) {
console.log(arg1);
} else {
return arg2;
}
}
canAcceptAnyArgs( 1 );
canAcceptAnyArgs( 1, 2, 3);
anonymousFunction(); // Error! undefined
namedFunction(); // This is fine
if (true && 999 && { } && [ ] && function(){ })
"these are all truthy values";
if (false || 0 || "" || null || undefined)
"these are all falsey values";
Type Coercions
(function() {
var a = 1;
if (true) {
var a = 2;
(function() {
var a = 3;
console.log(a);
})();
console.log(a);
}
console.log(a);
})();
var toggled = false;
document.addEventListener('click', function() {
toggled = !toggled;
});
Person
prototype
function
getName()
saySomething()
setName(name)
Person.prototype.setName = function(name) {
this.name = name;
};
Person.prototype.getName = function() {
return this.name;
};
Person.prototype.saySomething = function() {
console.log("My name is " + this.getName());
};
WebDev
prototype
function
saySomething()
writeJavaScript()
WebDev.prototype = new Person();
WebDev.prototype.writeJavaScript = function(linesOfCode) {
console.log(new Array(linesOfCode).join("JavaScript! \n"));
};
WebDev.prototype.saySomething = function() {
console.log("I love all the JavaScripts!");
};
new WebDev()
getName()
saySomething()
setName(name)
writeJavaScript()
"use strict";
jshint
@jsdoc
Conventions, Class, _private
Unique method names, consistency
(123 == "123") // true
(123 === "123") // false
2
Full transcript