DKay
DKay

Reputation: 21

nodejs console.log does not produce a output on Windows inside a funtion

I tried the following code(which is produced by corresponding Typescript code) and played with some solution in previous questions and answers. No luck, nothing is produced by the code inside the Startup() function, but works with the two bottom lines. Any idea? I was using both Nodejs 6.11.x and 8.4.x on both Windows 7sp1 and 10.

Thanks,

David

var Startup = /** @class */ (function () {
    function Startup() {
    }
    Startup.main = function () {
        console.log('Hello World!');
        console.warn('This is a warning!');
        return 0;
    };
    return Startup;
}());
console.log("This is log");
console.warn("Thi is warn");
//# sourceMappingURL=HelloWorld.js.map

Sorry, more info oh the corresponding TypeScript file

class Startup {
    public static main(): number {
        console.log('Hello World!');
        console.warn('This is a warning!');
        return 0;
     }
 }
 console.log("This is log");
 console.warn("Thi is warn");

Upvotes: 1

Views: 198

Answers (1)

Syed Ayesha Bebe
Syed Ayesha Bebe

Reputation: 1448

Try with this code

function Startup() {
    console.log('Hello World!');
    console.warn('This is a warning!');
        return Startup;
}
Startup();

console.log("This is log");
console.warn("Thi is warn");

And this is giving me output as

enter image description here

Hope this helps..

Upvotes: 2

Related Questions