Last active
December 30, 2015 10:29
-
-
Save ethnt/7816282 to your computer and use it in GitHub Desktop.
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
function HelloWorld (name) { | |
this.name = name; | |
} | |
HelloWorld.prototype.sayHello = function() { | |
return "Hello there " + this.name; | |
} | |
var hi = new HelloWorld("Ethan"); | |
hi.sayHello(); // => "Hello there Ethan" |
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 HelloWorld: | |
def __init__(self, name): | |
self.name = name | |
def say_hello: | |
return "Hello there " + self.name | |
hi = HelloWorld("Ethan") | |
hi.say_hello #=> "Hello there Ethan" |
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 HelloWorld | |
def initialize(name) | |
@name = name | |
end | |
def say_hello | |
"Hello there #{@name}" | |
end | |
end | |
hi = HelloWorld.new("Ethan") | |
hi.say_hello # => "Hello there Ethan" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment