Keyword in the comment affecting excecution of code

Tell us what’s happening:
Describe your issue in detail here.
Hello guys.There is something I am failing to understand,although i used the ‘var’ keyword in the comment as a reminder for next time i want to go through my code I am getting an error of “var should not exist in the code”.Why is it that a keyword i used in the comments affecting the overall excecution of my code?.Thank you
Your code so far

/*One of the biggest problems with declaring variables with the var keyword is that you can overwrite variable declarations without an error.
In a small application, you might not run into this type of problem, but when your code becomes larger, you might accidentally overwrite a variable that you did not intend to overwrite.
A new keyword called let was introduced in ES6 to solve this potential issue with the var keyword
let catName;
let quote;
function catTalk() {
"use strict"; 
catName = "Oliver";
quote = catName + " says Meow!";

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37

Challenge: Explore Differences Between the var and let Keywords

Link to the challenge:

That’s probably just a side effect of how tests are implemented:

getUserInput => assert(!getUserInput('index').match(/var/g));

That test is looking that in all your input there’s no var written anywhere, it won’t discriminate if it’s a comment or not.

Hope this helps clarifying things up.

1 Like

Yes that clarifies things thank you.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.