News for hackers. Stuff that matters.
Re:Module Pattern in JavaScript and CoffeeScript by drinchev on Saturday June 01, 2013 @03:53AM (#5803187)
Well I really prefer creating classes and AMD modules for almost everything. Using CoffeeScript this is just a couple of rows:

    class Calculator

        prettyText = "Answer is: "
        printResult = (result) -> console.log result
  
        add: (addedOne, addedTwo) => 
           sum = addedOne + addedTwo
           printResult prettyText + sum

    calculator = new Calculator();

There are no comments on this comment yet.