Jump to content

The screen variable and jshint warnings


queequeg
 Share

Recommended Posts

I would like to make this warning go away , hopefully by fixing some problem I have:

rl.js|19| jshint warning: Redefinition of 'screen'. 

Here is the tutorial I'm working on: 

 

http://gamedevelopment.tutsplus.com/tutorials/how-to-make-your-first-roguelike--gamedev-13677

 

Here is a gist of code I'm working on from the tutorial.

 

https://gist.github.com/5588dcb8cb44d19137e0

 

So my question is what is wrong?  Why am I getting the above warning and how can I avoid having my linter complain?

Link to comment
Share on other sites

The warning explains the issue pretty well, you are redefining screen. All of your variables are created globally on the window object. The window object already has a variable named screen and you are initializing a variable named screen on the window object, thus "Redefinition of 'screen'".

To remove the warning change the variable name to an unused name or move it out of global scope.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...