First Review
Upcoming SlideShare
Loading in...5
×
 

First Review

on

  • 1,056 views

Review of JavaScript data types, variables, assignment and operators.

Review of JavaScript data types, variables, assignment and operators.

Statistics

Views

Total Views
1,056
Views on SlideShare
889
Embed Views
167

Actions

Likes
0
Downloads
16
Comments
0

3 Embeds 167

http://teaching.johnnunemaker.com 165
http://static.slidesharecdn.com 1
http://teaching.harmonyapp.com 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

First Review First Review Presentation Transcript

  • Review
  • typeof(13)
  • typeof(13) // "number"
  • typeof("potent potables")
  • typeof("potent potables") // "string"
  • "potent potables"[0]
  • "potent potables"[0] // "p"
  • what character is used to escape inside of strings?
  • what character is used to escape inside of strings? "this "will" work" "here's another good one" 'here's another good one'
  • what method will give you the number of characters in a string?
  • what method will give you the number of characters in a string? length "car".length // 3 "football".length // 8 "longer string with more letters".length // 31
  • what method will give you the index for a given character in a string?
  • what method will give you the index for a given character in a string? indexOf
  • 'baseball'.indexOf('base');
  • 'baseball'.indexOf('base'); // 0
  • 'baseball'.indexOf('se');
  • 'baseball'.indexOf('se'); // 2
  • "fail".toUpperCase();
  • "fail".toUpperCase(); // "FAIL"
  • "WIN".toLowerCase();
  • "WIN".toLowerCase(); // "win"
  • "foo".indexOf("bar");
  • "foo".indexOf("bar"); // -1
  • var vehicle = {'type':'SUV'}; vehicle.type
  • var vehicle = {'type':'SUV'}; vehicle.type // "SUV"
  • var vehicle = {}; vehicle.type = 'SUV'; vehicle.make = 'Ford'; vehicle.model = 'Escape'; vehicle.make;
  • var vehicle = {}; vehicle.type = 'SUV'; vehicle.make = 'Ford'; vehicle.model = 'Escape'; vehicle.make; // "Ford"
  • var vehicle = {type: 'SUV', make: 'Ford'}; vehicle['make'];
  • var vehicle = {type: 'SUV', make: 'Ford'}; vehicle['make']; // "Ford"
  • var colors = []; colors.length;
  • var colors = []; colors.length; // 0
  • var letters = ['z', 'y', 'x', 'w']; letters[1];
  • var letters = ['z', 'y', 'x', 'w']; letters[1]; // "y"
  • var letters = ['z', 'y', 'x', 'w']; letters.length;
  • var letters = ['z', 'y', 'x', 'w']; letters.length; // 4
  • var letters = ['z', 'y', 'x', 'w']; letters.indexOf('a');
  • var letters = ['z', 'y', 'x', 'w']; letters.indexOf('a'); // -1
  • var letters = ['z', 'y', 'x', 'w']; letters.indexOf('z');
  • var letters = ['z', 'y', 'x', 'w']; letters.indexOf('z'); // 0
  • var letters = ['z', 'y', 'x', 'w']; letters.indexOf('x');
  • var letters = ['z', 'y', 'x', 'w']; letters.indexOf('x'); // 2
  • var letters = ['z', ['y', 'x'], 'w']; letters[1];
  • var letters = ['z', ['y', 'x'], 'w']; letters[1]; // ['y', 'x']
  • var letters = ['z', ['y', 'x'], 'w']; letters[1][0];
  • var letters = ['z', ['y', 'x'], 'w']; letters[1][0]; // 'y'
  • var letters = ['z', ['y', 'x'], 'w']; letters[1][0]; // 'y' letters[1][1];
  • var letters = ['z', ['y', 'x'], 'w']; letters[1][0]; // 'y' letters[1][1]; // 'x'
  • var letters = ['z', ['y', 'x'], 'w']; letters[1][0]; // 'y' letters[1][1]; // 'x' letters[2];
  • var letters = ['z', ['y', 'x'], 'w']; letters[1][0]; // 'y' letters[1][1]; // 'x' letters[2]; // 'w'
  • var a = [1, 2]; var b = [3, 4]; var c = a.concat(b); c
  • var a = [1, 2]; var b = [3, 4]; var c = a.concat(b); c // [1, 2, 3, 4]
  • ['a', 's', 'd', 'f'].join('');
  • ['a', 's', 'd', 'f'].join(''); // "asdf"
  • ['a', 's'].join('/');
  • ['a', 's'].join('/'); // "a/s"
  • [1, 2, 3].reverse();
  • [1, 2, 3].reverse(); // [3, 2, 1]
  • var last = [1, 2, 3].pop(); last;
  • var last = [1, 2, 3].pop(); last; // 3
  • var numbers = [1, 2, 3]; numbers.unshift(4) numbers;
  • var numbers = [1, 2, 3]; numbers.unshift(4) numbers; // [4, 1, 2, 3]
  • how do you declare a variable?
  • how do you declare a variable? var
  • good or bad? var field;
  • good or bad? var field;
  • good or bad? var 2fields;
  • good or bad? var 2fields; can’t start with numbers
  • good or bad? var sectionfieldname;
  • good or bad? var sectionfieldname; no _ between words
  • good or bad? var section_title;
  • good or bad? var section_title;
  • var a = 5; var b = 2; var sum = a + b; sum;
  • var a = 5; var b = 2; var sum = a + b; sum; // 7
  • var grade = 4.0; // for answering questions grade -= 0.5; grade;
  • var grade = 4.0; // for answering questions grade -= 0.5; grade; // 3.5
  • var remainder = 10 % 2; remainder += 5; remainder;
  • var remainder = 10 % 2; remainder += 5; remainder; // 5
  • var current_salary = 40000; var new_salary = 50000; var raise = new_salary > current_salary; raise;
  • var current_salary = 40000; var new_salary = 50000; var raise = new_salary > current_salary; raise; // true
  • var current_salary = 50000; var new_salary = current_salary - 10000; var raise = new_salary > current_salary raise;
  • var current_salary = 50000; var new_salary = current_salary - 10000; var raise = new_salary > current_salary raise; // false
  • var colors = ['blue', 'red', 'green']; var favorite = 'blue'; colors.indexOf(favorite);
  • var colors = ['blue', 'red', 'green']; var favorite = 'blue'; colors.indexOf(favorite); // 0
  • var score = 35; score += 7; score >= 20;
  • var score = 35; score += 7; score >= 20; // true