Created
August 11, 2016 23:33
-
-
Save anonymous/0aa4d75a411dfc1a871f9fe1e2193a47 to your computer and use it in GitHub Desktop.
explains instances // source http://jsbin.com/huqugu
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>explains instances</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
function vehicle(color){ | |
this.color = color; | |
} | |
//car is an instance of the vehicle constructor | |
// the new keyword is creating a new instance aka object | |
var car = new vehicle('red'); | |
console.log(car.color); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function vehicle(color){ | |
this.color = color; | |
} | |
//car is an instance of the vehicle constructor | |
// the new keyword is creating a new instance aka object | |
var car = new vehicle('red'); | |
console.log(car.color);</script></body> | |
</html> |
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 vehicle(color){ | |
this.color = color; | |
} | |
//car is an instance of the vehicle constructor | |
// the new keyword is creating a new instance aka object | |
var car = new vehicle('red'); | |
console.log(car.color); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment