concept comment in category coffeescript

This is an excerpt from Manning's book CoffeeScript in Action.
In this chapter, you’ll learn about expressions, operators, and statements, as well as how they work in CoffeeScript and how they’re related to the JavaScript equivalents. You’ll explore fundamental building blocks of CoffeeScript programs with strings, arrays, comments, and regular expressions. You’ll begin with a program.
CoffeeScript provides variants of strings, comments, and regular expression literals that can contain whitespace, such as newlines. All of these are indicated with syntax similar to their nonwhitespace counterparts but have a triple of the character for opening and closing the literal. Because they can contain literal whitespace, heredocs, herecomments, and heregexes are useful where formatting needs to be preserved and also for retaining clarity in code that would be difficult to read if the whitespace wasn’t preserved.
Listing 12.15. Comments specification (spec/comments_spec.coffee)
{describe, it} = require 'chromic' {Comments} = require '../../app/client/comments' describe 'Comments', -> it 'should post a comment to the server', -> requested = false httpRequest = (url) -> requested = url comments = new Comments 'http://the-url', {}, httpRequest comment = 'Hey Agtron. Nice site.' comments.post comment requested.shouldBe "http://the-url/comments?insert=#{comment}" it 'should fetch the comments when constructed', -> requested = false httpRequest = (url) -> requested = url comments = new Comments 'http://the-url', {}, httpRequest requested.shouldBe "http://the-url/comments" it 'should bind to event on the element', -> comments = new Comments 'http://the-url', {}, -> element = querySelector: -> element value: 'A comment from Scruffy' comments.bind element, 'post' postReceived = false comments.post = (comment) -> postReceived = comment element.onpost() postReceived.shouldBe element.value it 'should render comments to the page as a list', -> out = innerHTML: (content) -> renderedContent = content comments = new Comments 'http://the-url', out, -> comments.render '["One", "Two", "Three"]' out.innerHTML.shouldBe "<ul><li>One</li><li>Two</li><li>Three</li></ul>"