0
Learn you some JavaScript for the
great good
Why learn you JavaScript?
It's such awesome!
Why such awesome?
●

Closures

●

Functions is first class such power

●

So fast
Goal of lesson
●

Understand:

function Person (name) {
this.name = name;
}
Person.prototype.getName = function () {
retur...
So variables in JavaScript
●

Variables are declared:
var doge = 'doge';

●

Data types:
1. Number
2. Object
3. Array
4. S...
Much examples
var dog = 'doge';
var dog = {name: 'doge'};
var dog = ['dog'];
var isDoge = true;
var numDoge = 1; //only on...
Wow Objects
var person = {name: 'Bill',
age: 33};
console.log(person.name) //'Bill'
console.log(person.age) //33
Much Functions
function doFizzBuzz (range) {
var i = 0,
toReturn = '';
for (i = 0; i < range; i++) {
if (i % 3 === 0) {
to...
Functions === Objects
Much idiomatic
function doFizzBuzz (range) {
var i = 0;
for (i = 0; i < range; i++) {
if (i % 3 === 0) {
this.result += 'F...
Much high order function
//interval stores the id of this interval
var interval = window.setInterval(function () {
if (thi...
Learnjs
Learnjs
Upcoming SlideShare
Loading in...5
×

Learnjs

254

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
254
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Learnjs"

  1. 1. Learn you some JavaScript for the great good
  2. 2. Why learn you JavaScript? It's such awesome!
  3. 3. Why such awesome? ● Closures ● Functions is first class such power ● So fast
  4. 4. Goal of lesson ● Understand: function Person (name) { this.name = name; } Person.prototype.getName = function () { return this.name; } ● Wow very function
  5. 5. So variables in JavaScript ● Variables are declared: var doge = 'doge'; ● Data types: 1. Number 2. Object 3. Array 4. Strings 5. Booleans
  6. 6. Much examples var dog = 'doge'; var dog = {name: 'doge'}; var dog = ['dog']; var isDoge = true; var numDoge = 1; //only one doge!
  7. 7. Wow Objects var person = {name: 'Bill', age: 33}; console.log(person.name) //'Bill' console.log(person.age) //33
  8. 8. Much Functions function doFizzBuzz (range) { var i = 0, toReturn = ''; for (i = 0; i < range; i++) { if (i % 3 === 0) { toReturn += 'Fizz'; } if (i % 5 === 0) { toReturn += 'Buzz'; } toReturn += 'n'; } return toReturn; }
  9. 9. Functions === Objects
  10. 10. Much idiomatic function doFizzBuzz (range) { var i = 0; for (i = 0; i < range; i++) { if (i % 3 === 0) { this.result += 'Fizz'; } if (i % 5 === 0) { this.result += 'Buzz'; } this.result += 'n'; } }
  11. 11. Much high order function //interval stores the id of this interval var interval = window.setInterval(function () { if (this.isVisible === true) { document.getElementById('change').style.visibility = 'hidden'; this.isVisible = false; } else { document.getElementById('change').style.visibility = 'visible'; this.isVisible = true; } }, 500);
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×