/typescript/

TypeScript part 2 (function)

2017-03-02 21:04:28

TypeScript

function log(string: String): void {
    console.log("log: " + string);
}

function getName(): string {
    return "Michał";
}

function getNumber(): number {
    return 1;
}

function isValid(): boolean {
    return true;
}

log("test");
console.log(2, getName());
console.log(3, getNumber());
console.log(4, isValid());

JavaScript

function log(string) {
    console.log("log: " + string);
}
function getName() {
    return "Michał";
}
function getNumber() {
    return 1;
}
function isValid() {
    return true;
}
log("test");
console.log(2, getName());
console.log(3, getNumber());
console.log(4, isValid());