#11 Nullable Type (Advanced Types)

 Null cannot be used like we use in JS. Null is hardly used and we we must use we should modify the function itself like;

function name(first=string | null){console.log("Hi")}

name(null);

Here we defined that the value may also be a null for null to act without errors.

Comments

Popular posts from this blog

#6 Objects (Fundamentals of TS)

#8 Union Type (Advanced Types)