Learning JavaScript 102 (wad-js-02)

This is lesson 2 in Learning to Code, JavaScript 101 for Beginners. For Learning JavaScript 101 (wad-js-01), see here.

You should have basic knowledge of HTML, a text editor like ‘sublime text’ installed, and a web browser.

Register here.

  1. Recap 101
  2. Data Types
    • Primitive types
      1. Number
      2. String
      3. Boolean
      4. Undefined
      5. Null
      6. Symbol (new in ES6)
    • Object types: String, Integer vs int etc.
    • Operators: +, -, ++, –, =, %, /, *, +=, -=, *=, == (abstract), === (strict), !, !===, !, &&, ||, >, <, >=, <=, ? :, typeof, instanceof
    • Arrays
      • var arr = []
      • var arr = new Array()
      • arr = [‘a’,’b’]
      • arr[0]
      • associative arrays
      • arr.push()
      • arr.pop()
      • arr.unshift()
      • arr.shift()
      • arr.splice(1, 0, ‘a’, ‘b’) – add new items at position, and remove n elements..
      • arr.splic(0, 1) – removes pos=0, number of elements=1
      • arr1.concat(arr2)
      • arr.slice(3) – from position 3 to end copy into new array
      • arr.length
      • arr.sort() – sorts strings
      • arr.sort(function(a, b) {return a – b}); – for numeric sort, sort ascending, if negative, then a is lower than b, if positive then a is higher than b.
      • arr.sort(function(a, b) {return b – a}); – sort descending
    • Objects (js103 – lesson 3)
  3. Iterations
    • for item in list
    • for(int i=0; i<10; i++)
    • while
    • do…while
    • break
    • continue
  4. Conditions: if else
  5. Try…Catch…Finally
  6. Functions, JavaScript is a functional language. Functions are first-class objects:
    • assign to variable
    • pass as argument
    • returned
    • dynamically create properties

Comment (1)

  1. Pingback: Learning JavaScript 103 (wad-js-03) – remkohde

Leave a Comment

Your email address will not be published. Required fields are marked *

%d bloggers like this: