It is common to initialize a variable to an initial value in the same line as it is declared. var myVar = 0; Creates a new variable called myVar and assigns it an initial value of 0.
Assignment operators. An assignment operator assigns a value to its left operand based on the value of its right operand. The simple assignment operator is equal ( = ), which assigns the value of its right operand to its left operand. That is, x = f() is an assignment expression that assigns the value of f() to x.
The correct answer is var a = 9;
If you want to see the results you can console.log(9); and you will see the answer of 9. However, the answer will be incorrect so all you need to do to pass the test is to create var a = 9.
What is JavaScript console.log()? log() The console. log() method outputs a message to the web console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
How to check console.log() in JavaScript? In the Chrome browser, select the Customize and control Google Chrome icon.
Select Tools (greater-than sign) JavaScript Console. Chrome Developer tools.
In the DevTools panel, with the Console menu item selected, you should see your console messages displayed here. Chrome Console.