Certified Animation Professional (CAP) Practice Test

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for the Certified Animation Professional Exam. Use engaging quizzes with flashcards and multiple choice questions, each with hints and detailed explanations. Gear up for success!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


In JavaScript, which keyword is used for creating a constant variable?

  1. const

  2. let

  3. var

  4. static

The correct answer is: const

In JavaScript, the keyword used for creating a constant variable is "const." This keyword allows you to declare a variable whose value cannot be reassigned after its initial assignment. When you use "const," it indicates that the variable is meant to remain constant throughout its scope, which aligns with the principles of maintaining variables that should not change, enhancing both code reliability and readability. For example, if you declare a variable with "const" and then attempt to change its value later in the code, JavaScript will throw an error, preventing unintended modifications. This is particularly important in programming where constants can hold references to objects or arrays and can still allow modification of the properties of those objects, but the reference itself cannot be changed. The other keywords like "let" and "var" serve different purposes: "let" is used for block-scoped variables that can be reassigned, and "var" is used for function-scoped variables, which can also be reassigned. The keyword "static" is not relevant here, as it is primarily used in other programming languages, like Java or C#, to indicate static properties or methods associated with a class rather than in JavaScript for variable declaration.