Skip to content

Instantly share code, notes, and snippets.

View ricca509's full-sized avatar

Riccardo Coppola ricca509

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
function World (name) {
@ricca509
ricca509 / prototypalInheritance.js
Created November 6, 2012 09:23
Prototypal inheritance
// 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
@ricca509
ricca509 / contructorInvocation.js
Created November 5, 2012 22:10
Constructor invocation
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