How to use the prompt and alert javascript commands in webstorm?

When I try to use a prompt or warning to get user input in webstorm, I get an error:

answers[i] = prompt(allQuestions[i].question) ^ 

ReferenceError: tooltip not defined

As far as I know, tooltip and warning are great features in javascript. Maybe because I run the code in the console? If so, how do I set variables for user-entered strings (i.e. a hint function)? If not, what will be wrong and how to fix it?

+5
source share
1 answer

By running the code in the console, do you mean that you run it using Node.js? But the hint (as well as a warning, etc.) cannot be used in server-side scripts executed by Node.js. You can only request javascript on the client side from the user, that is, work in the browser using the tag in the processed HTML, and not on the Javascript API server running on the server.

+5
source

Source: https://habr.com/ru/post/1204890/


All Articles