Created
November 26, 2011 23:05
-
-
Save isaacsanders/1396463 to your computer and use it in GitHub Desktop.
Ruby v JS
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
Foo = function(bar) { | |
this.bar = bar; | |
} | |
foo = new Foo('baz'); | |
foo.bar = 'qux'; | |
// This works. |
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
class Foo; end | |
foo = Foo.new | |
foo.bar = :baz | |
# This raises an exception | |
class Foo | |
attr_accessor :bar | |
end | |
foo = Foo.new | |
foo.bar = :baz | |
# This works. Feels weird. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment