Last active
August 29, 2015 14:07
-
-
Save erikroyall/96a07e0750ec1bf9a1ee to your computer and use it in GitHub Desktop.
JavaScript and Semicolons
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
function Person (name, age) { | |
this.name = name; | |
this.age = age; | |
} | |
Person.prototype = { | |
getName: function () { | |
return this.name; | |
}, | |
getAge: function () { | |
return this.age; | |
} | |
} | |
var me = new Person("Erik Royall", 15); | |
var string = ""; | |
string += (me.getName()); | |
string += (" is "); | |
string += (me.getAge()); | |
string += (" years old."); | |
console.log(string); |
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
function Person (name, age) { | |
this.name = name | |
this.age = age | |
} | |
Person.prototype = { | |
getName: function () { | |
return this.name | |
}, | |
getAge: function () { | |
return this.age | |
} | |
} | |
var me = new Person("Erik Royall", 15) | |
var string = "" | |
string += (me.getName()) | |
string += (" is ") | |
string += (me.getAge()) | |
string += (" years old.") | |
console.log(string) |
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
function Person (name, age) {;; | |
;;this.name = name;;;;;;;;;;;;; | |
;;this.age = age;;;;;;;;;;;;;;; | |
};;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
Person.prototype = {/*;;;;;;;;; | |
*/getName: function () {;;;;;;; | |
;;;;return this.name;;;;;;;;;;; | |
;;},/*;;;;;;;;;;;;;;;;;;;;;;;;; | |
*/getAge: function () {;;;;;;;; | |
;;;;return this.age;;;;;;;;;;;; | |
;;}//;;;;;;;;;;;;;;;;;;;;;;;;;; | |
};;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
var me = new Person(//;;;;;;;;; | |
"Erik Royall",//;;;;;;;;;;;;;;; | |
15);;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
var string = "";;;;;;;;;;;;;;;; | |
string += (me.getName());;;;;;; | |
string += (" is ");;;;;;;;;;;;; | |
string += (me.getAge());;;;;;;; | |
string += (" years old.");;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
console.log(string);;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment