194k views
0 votes
InJavaScript, a variable declaration is

?Optional
?Mandatory
?Not allowed
?None of the given

User SaAction
by
5.8k points

1 Answer

3 votes

Answer:

Optional

Step-by-step explanation:

Variable declaration means when you declaring a variable in the code,whenever you want to use a variable you should declare it or define the variable with come constant.

Example

var name ;

The variable has no value after the statement (technically it has undefined value). Declaring a variable without var keyword is not recommended. An current global variable may accidentally be overwritten.

Example

a=2;

The range of variables declared without var keywords becomes global regardless of where they are declared

User Sandy Chapman
by
5.7k points