Skip to content

Instantly share code, notes, and snippets.

@Bijesse
Forked from anonymous/index.html
Created August 11, 2016 23:33
Show Gist options
  • Save Bijesse/c56b86d6c0d703835c46652b49a0a866 to your computer and use it in GitHub Desktop.
Save Bijesse/c56b86d6c0d703835c46652b49a0a866 to your computer and use it in GitHub Desktop.
explains instances // source http://jsbin.com/huqugu
<!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>
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