var s = "Hi";
Date.now = function (){
return new Date();
}
s.createdOn = function (){
return new Date();
}
alert(s.createdOn()); // This is not working
alert(Date.now()); // This works fine
Am i violating any rule. Because i can add new property to Date class but not to string class. why?