About 1,070,000 results
Open links in new tab
  1. javascript - specify the variable type in the prompt - Stack Overflow

    Jan 12, 2018 · How to specify the type of the input in the prompt field(eg:number,string). var jonage = prompt("enter the johns age"); var jonHeight = prompt("enter the johns height"); var …

  2. Window prompt() Method - W3Schools

    The prompt() method displays a dialog box that prompts the user for input. The prompt() method returns the input value if the user clicks "OK", otherwise it returns null.

  3. How to take user input in JavaScript? - GeeksforGeeks

    Aug 13, 2024 · Here we will see the approach to take user input in JavaScript, specifically using the prompt method, which is perfect for beginners. The prompt method is part of the …

  4. string - How to test type of input into prompt for conditional ...

    Mar 28, 2018 · The type of value you get from a prompt will always be a string, even if it has numbers in it. If you want to check to see if a string consists of only numbers, you can use a …

  5. How to get numeric value from a prompt box? - Stack Overflow

    Jul 28, 2013 · parseInt() or parseFloat() are functions in JavaScript which can help you convert the values into integers or floats respectively. Syntax: parseInt(string, radix); parseFloat(string);

  6. Window: prompt() method - Web APIs | MDN - MDN Web Docs

    Feb 20, 2025 · window.prompt() instructs the browser to display a dialog with an optional message prompting the user to input some text, and to wait until the user either submits the …

  7. How to Take Input in JavaScript from Users | Prime Inspire

    Apr 21, 2025 · Using prompt () for Quick Input. The simplest way to get user input is with the prompt () method. It pops up a small dialog box where users can type something. It’s old …

  8. JavaScript Type Conversions - W3Schools

    JavaScript variables can be converted to a new variable and another data type: The global method Number() converts a variable (or a value) into a number. A numeric string (like "3.14") …

  9. Type Casting in JavaScript. Typecasting in JavaScript is the

    May 13, 2023 · There are two types of typecasting — implicit typecasting and explicit typecasting. The implicit type conversion takes place automatically by the interpreter or the compiler when …

  10. How can I cast a variable to the type of another in Javascript

    You can use the typeof operator to get the right "casting" function: return { 'string': String.bind(null, input), 'number': Number.bind(null, input) //etc. }[typeof typedVar](); Try it out here: …

  11. Some results have been removed
Refresh