Posted over 2 years ago. Visible to the public.

Javascript basics

Play with the language:

  • Variables
  • Loops
  • Functions
  • Understand the difference between function pointers ("anonymous functions") and function invocations
    • Understand the parallels between blocks/lambdas in Ruby and anonymous functions in Javascript



You should be able to answer the following questions:

  • Understand why we need Javascript
  • Understand what jQuery does
  • Understand how to select DOM elements using jQuery
  • Understand the difference between a jQuery collection/object/result set and naked DOM elements
    • Open any web page and use jQuery to select DOM nodes from a browser's developer console
  • Understand how to register event handlers using jQuery
  • Understand why we often use a library "Lodash.js" or "Underscore.js"
  • There are no classes in Javascript. Understand some workarounds that people use:
  • Understand what this is in Javascript and why it's painful to use it
  • Understand why we sometimes use Coffeescript (you don't need to understand the language in its entirety)

  • Exercises

  • Write your own version of the function. Name it myMap. It should work exactly like, but should be your own code.
  • Can you write a Javascript function mySelect that works like Ruby's Enumerable#select, only as a Javascript equivalent?
  • In your MovieDB, in the movies list, add a button that says "Count movies". Once the user clicks on that button, a piece of Javascript will count the movies in the list above and replace the button text with the number of movies counted.

Author of this card:

Henning Koch
Last edit:
13 days ago
by Florian Leinsinger
Posted by Henning Koch to makandra Curriculum