Posted about 4 years ago. Visible to the public.

Advanced JavaScript [3d]

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.

ES6+

CoffeeScript

  • We broke with CoffeeScript before their switch to version 2
    • Understand that version 1 transpiled to ES5 while version 2 transpiled to ES6+
    • Realize that the current CoffeeScript documentation is not about version 1
      • If you want to read the documentation for version 1, use an older snapshot saved at archive.org or devdocs.io.
      • The archive.org snapshot should be fully functional, including the "Try CoffeeScript" console. You may need to close the archive.org bar at the top to reveal the navigation.
  • Understand some key aspects that you will find in code of existing projects
  • Browsers don't understand CoffeeScript. Find the component in our stack that fixes this.

Equality

Closures

Excercises

  • 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.
  • 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
  • Find ways to test equality (what humans mean when they say "equal") for the following types.
    • String
    • Number
    • undefined
    • null
    • Array
    • Structured data structures consisting of nested objects, arrays and scalar 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:
2 days ago
by Arne Hartherz
Posted by Arne Hartherz to makandra Curriculum
This website uses cookies to improve usability and analyze traffic.
Accept or learn more