11.
Which of the following options correctly declares and assigns a value to a variable in JavaScript?
var x = 10;
let y = true;
const z = "Hello!";
x = 5;
Correct: A, B, C
In JavaScript, variables can be declared and assigned values using the var, let, or const keywords. Option A1 declares a variable named x using the var keyword and assigns it the value 10. Option A2 declares a variable named y using the let keyword and assigns it the value true. Option A3 declares a constant variable named z using the const keyword and assigns it the value "Hello!". Option A4, on the other hand, only assigns a value to an undefined variable and does not declare it.