Assuming you're using JSHint in WebStorm, set Preferences > Languages & Frameworks > JavaScript > Code Quality Tools > JSHint > Environments > Browser to true
Screenshot of WebStorm settings
Update:
Also, as mentioned earlier, for good code you should use window.prompt
, just so it's clear you're using the built in browser prompt rather than a custom function etc... (the same goes for alert, so use window.alert
)
Finally, unrelated to the question, but something I noticed - it's good practice to use the ===
operator. There are a million articles online explaining why :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…