Created
March 2, 2013 05:12
-
-
Save michelle/5069792 to your computer and use it in GitHub Desktop.
More CoffeeScript oddities.
This file contains 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
window.Michelle = | |
username: 'michellebu' | |
Hobbies: | |
daytime: 'biking' | |
evening: 'walks' | |
Friends: {} | |
class Michelle.Friends.Michelle | |
username: 'othermichelle' | |
morningCompatible: -> | |
# Will error because Hobbies is undefined. | |
Michelle.Hobbies.daytime is 'running' | |
eveningCompatible: -> | |
# Will error because Hobbies is undefined. | |
Michelle.Hobbies.evening is 'drinking' | |
# compiled: | |
window.Michelle = { | |
username: 'michellebu', | |
Hobbies: { | |
daytime: 'biking', | |
evening: 'walks' | |
}, | |
Friends: {} | |
}; | |
Michelle.Friends.Michelle = (function() { | |
function Michelle() {} | |
Michelle.prototype.username = 'othermichelle'; | |
Michelle.prototype.morningCompatible = function() { | |
return Michelle.Hobbies.daytime === 'running'; | |
}; | |
Michelle.prototype.eveningCompatible = function() { | |
return Michelle.Hobbies.evening === 'drinking'; | |
}; | |
return Michelle; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment