Which is the correct syntax to declare a constant in JavaScript?

23. Which is the correct syntax to declare a constant in JavaScript?

  1. const constant_name;
  2. constant_name const;
  3. constant_name const = value;
  4. const constant_name = value;

Answer: D) const constant_name = value;

Explanation:

The correct syntax to declare a constant is:

const constant_name = value;

Example:

const PI = 3.14; 

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.