user1679941
user1679941

Reputation:

Default an argument to a value of false for a Typescript function

I have this Typescript code:

isConnected = (databaseCheck): ng.IPromise<any> => {
    var abc = databaseCheck;
};

Is there a way that I can make it default to databaseCheck being false if no value is supplied?

Upvotes: 0

Views: 241

Answers (1)

Amid
Amid

Reputation: 22352

Yes

isConnected = (databaseCheck: boolean = false): ng.IPromise<any> => {
    var abc = databaseCheck;
};

Upvotes: 1

Related Questions