Posted almost 5 years ago. Visible to the public.

Advanced JavaScript [2.5d]

Stepping forward from JavaScript Basics, the goal of this card is for you to be able to read and write more complex ES6+ and CoffeeScript code, and to migrate code from one language to another.
While we don't use CoffeeScript in new projects any more, we require you to understand it enough to work on existing projects that use it.

The JavaScript Object Model

Read The JavaScript Object Model: A deep dive into prototypes and properties.

There's also a video of that talk in our internal library.

ES6 ("ES Next")

CoffeeScript

Equality

Closures

Exercises

  • Important: For the following excercies, don't simply use a library or Stackoverflow code for this. You can look at other people's code to see how it works, but you must understand the concepts and be able to implement them on your own.
  • Hints:
  • Write a simple class
    • Class Rectangle, has properties width and height. Offers area method that returns the product of width and height.
    • Implement it in CoffeeScript.
    • Implement it in ES6.
    • Compare the transpiled ES5 output of both. Note their class boilerplates.
    • Manually convert the ES6 class to ES5 using the module pattern (see a simple workaround for classes in ES5).
  • Write a sum method that takes an arbitrary number of arguments ("rest args") and computes their sum.
    • Implement it in ES6, CoffeeScript, and ES5 separately (without using a transpiler)
    • Implement sum in ES5 as an IIFE
  • Write an isEqual() method that compares objects of the following types:
    • string
    • number
    • undefined
    • null
    • Array
    • typeless object (key/value properties)
    • Structured data structures consisting of nested objects, arrays and primitive variables
  • Discuss with our mentor:
    • Now that you have written some JavaScript and Ruby, which one do you like better? Can you point to concrete examples why you think that way?
    • What can tools like CoffeeScript or Lodash.js do to "fix" JavaScript? What can't they fix?

Owner of this card:

Avatar
Arne Hartherz
Last edit:
3 days ago
by Henning Koch
Posted by Arne Hartherz to makandra Curriculum
This website uses cookies to improve usability and analyze traffic.
Accept or learn more