随笔分类 - CoffeeScript
摘要:CoffeeScript is a little language that compiles into JavaScript. Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous hear...
阅读全文
摘要:class Map constructor : -> @entry = {} @count = 0 size : -> return @count isEmpty : -> return @count == 0 containsKey : (key) -> if @isEmpty() return false return @entry.hasOwnProperty key containsValue : (val)-> ...
阅读全文
摘要:CoffeeScript is a little language that compiles into JavaScript.Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.The golden rule of CoffeeScript is:"It's just JavaScript&q
阅读全文
摘要:TABLE OF CONTENTSTRY COFFEESCRIPTANNOTATED SOURCECoffeeScript is a little language that compiles into JavaScript.Underneath all those awkward braces and semicolons, JavaScript has always had a gorgeous object model at its heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a
阅读全文
摘要:在没有使用coffee-script之前,我们写类是这样写的,感觉会有点繁锁://-------------抽象类形状--------------function Shape(edges) { this.edges = edges;}Shape.prototype.getArea = function() { return -1;}Shape.prototype.getEdges = function() { return this.edges;}//--------------三角形----------------function Triangle(bottom, heig...
阅读全文