Object prototype example

<script type="text/javascript">

String.prototype.toBoldGreenCaps = function(){
var rawString = this;
rawString = rawString.bold();
rawString = rawString.fontcolor('green');
finalString = rawString.toUpperCase();
return finalString;
}

var testString = "My test string to format - toBoldGreenCaps()";
document.write(testString.toBoldGreenCaps());

</script>

0 Comments

You must be logged in to post a comment.