TypeScript - let & backticks

What is let:
* Its like Javascript var keyword;
* In var keyword in javascript have some gotchas and pitfalls like scoping, capturing etc.,
* let keyword is solving those issues as well.

Typescript strongly Typed:
let found: boolean = true;
found = 0; // Compile time error will throw if you assign 0. mismatch the datatype.

let data: any = 50.0;
data = "Vinoth"; // true
data = false; // true

Try to avoid use any, because we will lose type safty.

Use backticks:
console.log("Hi " + firstname + " " + lastname);
console.log('Hi ${firstname} ${lastname}');

Comments

Popular posts from this blog

How to set Java Object into JaxBElement ?

GitLab