<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>042</title>
</head>
<body>
</body>
<script type="text/javascript">
(function () {
var str = 'one';
String.prototype.exclaim = function(){
if(this.length == 0) return this;
return this + '!';
}
var str2 = 'two';
console.log(str.exclaim());
console.log(str2.exclaim());
})();
(function () {
String.prototype.trim = function(){
return (this.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""));
}
})();
(function () {
function Tune (title, aritst) {
this.concatTitleArtist = function(){
return title + " " + aritst;
}
}s
var happySongs = new Tune("Putting on the Ritz", "Ella Fitzgerald");
Tune.prototype.addCategory = function(categoryName){
this.category = categoryName;
}
happySongs.addCategory("Swing");
var song = "Title and artist: " + happySongs.concatTitleArtist() + " Category: " + happySongs.category;
console.log(song);
})();
</script>
</html>