jcbridwe jcbridwe - 1 year ago 143
CoffeeScript Question

Inserting labeled javascript/json into a coffee format

I am trying to use Flot tooltip in a coffee file, but I am having trouble inserting the necessary labelled javascript/json code into the coffee code. I've tried the js2coffee converter tool, but it doesn't seem to work. Here's the code, I am trying to translate into coffee; any suggestions?

grid: { hoverable: true },
tooltip: {
show: true,
content: "y: %y"

Answer Source

The object can be written in CoffeeScript as follows:

somevar =
    hoverable: true
    show: true
    content: 'y: %y'

You can see the conversion to JavaScript live on

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download