What is the default visibility of a variable in Typescript, what is the importance of var when declaring variables?

Asked

Viewed 62 times

2

When declaring a variable, when we omit the visibility parameter (public, private and protected) the variable is created by default in which visibility?

export class AddEditTaskPage {

  idade: number;
  valor: string;
....

Just one more question, the word var is it optional? Do you have any particular reason to use it?

export class AddEditTaskPage {

  var idade: number;
  valor: string;
....

1 answer

0


Is public by default.

In Typescript, in class members, the var is unnecessary, is adopted the semantics of var even without its explicit use.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.