0 votes
in JavaScript by
Consider the following code snippet

const pi=3.14;

var pi=4;

console.log(pi);

What will be the output for the above code snippet?

a) This will flash an error

b) Prints 4

c) Prints 3.14

d) Ambiguity

1 Answer

0 votes
by

Answer:-  A

Reason:  Const keyword fixes the value of the variable) Const keyword can not be redefined) Therefore attempts to alter the value or re-declaration causes errors.

Related questions

+1 vote
asked Mar 22, 2021 in JavaScript by Robindeniel
0 votes
asked Oct 9, 2022 in JavaScript by Robin
...