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"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
function World (name) { |
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
// Define a new Constructor function | |
var Coffee = function(type) { | |
this.type = type; | |
} | |
// Add a property to our object | |
Coffee.prototype.taste = 'sweet'; | |
// Create an instance of Coffee | |
// This instance inherits all the properties of Coffee |
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
var Book = function(title) { | |
this.title = title; | |
} | |
// Let's add a method to Book | |
Book.prototype.getTitle = function() { | |
return this.title; | |
} | |
// Create an instance of Book |
NewerOlder