Home
Examples
Downloads
FAQ
Documentation
Road Map
Forums
|
"Hello World"
/* Let's print "Hello, World!" with colorful letters */
/* a function that returns a random color code in the form "#xxxxxx" */
function color() {
var s=Math.floor(Math.random()*256*256*256).toString(16);
return "#" + ("00000"+s).substr(-6);
}
/* a method that takes a plain text string, and apply HTML tags to render each character of the string with a random color */
String.prototype.colorize = function() {
var o='';
for (var i=0;i'+this.charAt(i)+'';
}
return o;
};
/* a method that surround the string with an HTML tag that renders the string 6 times better. */
String.prototype.big = function() {
return ""+this+"";
};
print("Hello, World!".colorize().big());
/* Note: print() is not part of the javascript language, but is defined to make this package useful out of the box. */
|