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>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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
angular.module('app', []) | |
.filter('truncate', function () { | |
return function (text, length, end) { | |
if (isNaN(length)) { | |
length = 10; | |
} | |
if (end === undefined) { | |
end = '...'; |
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 Person(firstName,lastName){ | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} | |
Person.prototype.fullName = function(){ | |
return this.firstName + " " + this.lastName; | |
} | |
function Superhero(firstName,lastName,powers){ |
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 Bike(options){ | |
this.wheels = 2; | |
this.color = options.color; | |
} | |
function Car(options){ | |
this.wheels = 4; | |
this.color = options.color; | |
} |
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 name = { | |
fName:'aaa', | |
lName:'bbb', | |
setName:function(fName,lName){ | |
this.fName = fName; | |
this.lName = lName; | |
}, | |
getName:function(){ | |
return this.fName + " " + this.lName; | |
} |
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 person(firstName,lastName){ | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} | |
person.prototype.fullName = function(){ | |
return this.firstName + " " + this.lastName; |
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 person(firstName,lastName){ | |
this.firstName = firstName; | |
this.lastName = lastName; | |
this.fullName = function(){ | |
return this.firstName + " " + this.lastName; | |
} | |
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 personModule = (function(){ | |
var firstName; | |
var lastName; | |
return{ | |
setName(f,l){ | |
firstName = f; | |
lastName = l; | |
}, |
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 personModule = (function(){ | |
var firstName; | |
var lastName; | |
function setName(f,l){ | |
firstName = f; | |
lastName = l; | |
} | |
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 singleton = (function(){ | |
var instance; | |
function init(){ | |
var name; | |
this.setName = function(name){ | |
this.name = name; |