Last active
June 14, 2018 01:52
-
-
Save AminBusiness/b9d8744628eb58cedc32cf2c8c62591e to your computer and use it in GitHub Desktop.
// source https://jsbin.com
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
//Passing properties into a function | |
function Person(first, last, age, eye) { | |
this.firstName = first; | |
this.lastName = last; | |
this.age = age; | |
this.eyeColor = eye; | |
this.nationality = "English"; | |
} | |
var myFather = new Person("John", "Doe", 50, "blue"); | |
var myMother = new Person("Sally", "Rally", 48, "green"); | |
document.getElementById("demo").innerHTML = | |
"My father is " + myFather.nationality + ". My mother is " + myMother.nationality; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
//Passing properties into a function | |
function Person(first, last, age, eye) { | |
this.firstName = first; | |
this.lastName = last; | |
this.age = age; | |
this.eyeColor = eye; | |
this.nationality = "English"; | |
} | |
var myFather = new Person("John", "Doe", 50, "blue"); | |
var myMother = new Person("Sally", "Rally", 48, "green"); | |
document.getElementById("demo").innerHTML = | |
"My father is " + myFather.nationality + ". My mother is " + myMother.nationality; | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">//Passing properties into a function | |
function Person(first, last, age, eye) { | |
this.firstName = first; | |
this.lastName = last; | |
this.age = age; | |
this.eyeColor = eye; | |
this.nationality = "English"; | |
} | |
var myFather = new Person("John", "Doe", 50, "blue"); | |
var myMother = new Person("Sally", "Rally", 48, "green"); | |
document.getElementById("demo").innerHTML = | |
"My father is " + myFather.nationality + ". My mother is " + myMother.nationality; </script></body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment