Programming Typescript
Class Variable in the Typescript
C#
Value of the class variable (name) is display in the Console.
TypeScript:
Javascript:
Output:
Get muralikrishna tb’s stories in your inbox
Join Medium for free to get updates from this writer.
Open the terminal.type the below commands
tsc filename.ts
node filename.js
Output
undefined,undefined
return the undefined Value of the class variable (firstname,lastname)is display in the output(terminal window).Please find the details as below:
1.Return the value is undefined of the class variable,if not initialize the value in the constructor.
2.Default created the parameterless function (foodetails) in the js,if not implement the constructor in the ts.
Return is undefined,if there is no parameter in the foodetails function (FooDetails ()) of the javascript.





