Help the world stop coronavirus! Stay home!

Prev Next

Angular / Typescript interview questions

What does the question mark (?) on a typescript variable/parameter name denote?

Question mark on a typescript variable marks it as optional. Any optional parameters must follow required parameters.

function sayHello(name: string, salutation?: string) {
    if (salutation)
        return  "Hello " + saluation +"." +  name;
        return "Hello " + name;

The optional parameters will have value as undefined when unused.

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

Show more question and Answers...

Node js

Comments & Discussions