Behold:
function Speak(somethingToSay:string) {
alert(somethingToSay);
}
function Speak(somethingToSay: string, isToSpeakLoudly: Boolean) {
if (isToSpeakLoudly) {
somethingToSay = somethingToSay.toUpperCase();
}
alert(somethingToSay);
}
Again, the one way which I have found that TypeScript is not to truly be a superset of JavaScript comes in an inability to call a function with fewer variables at the signature than are strictly specified without a compilation error. This is something that you may do in JavaScript and the missing variables towards the end just end up unset. What is above offers a way to compensate if you need this functionality.
No comments:
Post a Comment