Last active
August 29, 2015 14:03
-
-
Save olvap/75b1ad2f94f64ecf0be3 to your computer and use it in GitHub Desktop.
A comparation between Coffee and JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class PahoMessage | |
| constructor: (@message) -> | |
| value: -> | |
| "value: #{ @message }" | |
| topic: -> | |
| "topic: #{ @message }" | |
| paho_message = PahoMessage.new("un mensaje") | |
| console.log paho_message.value | |
| console.log paho_message.topic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var PahoMessage; | |
| PahoMessage = (function() { | |
| function PahoMessage(message) { | |
| this.message = message; | |
| } | |
| PahoMessage.prototype.value = function() { | |
| return "value: " + this.message; | |
| }; | |
| PahoMessage.prototype.topic = function() { | |
| return "topic: " + this.message; | |
| }; | |
| return PahoMessage; | |
| })(); | |
| paho_message = PahoMessage["new"]("un mensaje"); | |
| console.log(paho_message.value); | |
| console.log(paho_message.topic); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment