About 6,490 results
Open links in new tab
  1. javascript - How to get numeric value from a prompt box

    Jul 28, 2013 · Syntax: parseInt(string, radix); parseFloat(string); string: the string expression to be parsed as a number. radix: (optional, but highly encouraged) the base of the numeral system …

  2. JavaScript parseInt () Method - W3Schools

    The parseInt method parses a value as a string and returns the first integer. A radix parameter specifies the number system to use: 2 = binary, 8 = octal, 10 = decimal, 16 = hexadecimal. If …

  3. javascript - Sum of two numbers with prompt - Stack Overflow

    Mar 28, 2014 · The simplest is: var a = +prompt("Enter first number"); var b = +prompt("Enter second number"); alert(a + b); but you can also do var a = Number(prompt("Enter first …

  4. parseInt () - JavaScript | MDN

    Apr 3, 2025 · The parseInt () function parses a string argument and returns an integer of the specified radix (the base in mathematical numeral systems).

  5. JavaScript Program to Print an Integer Entered by user

    Feb 22, 2024 · In this example, prompt() displays a dialog box to the user to enter an integer, and parseInt() is used to convert the input string to an integer. The alert() function then displays the …

  6. JavaScript | Input value from the user using prompt

    Jul 30, 2023 · To input numbers i.e., integer values in JavaScript using the prompt () method, you need to parse the input value because the prompt () method returns the string. To parse the …

  7. parseInt() in JavaScript – A Master Class Guide for Converting …

    Whether you are fetching user input text or extracting numbers from API responses, understanding parseInt() will enable you to handle numeric data with confidence and mastery …

  8. JavaScript parseInt () Function - W3Schools

    The parseInt () function parses a string and returns an integer. The radix parameter is used to specify which numeral system to be used, for example, a radix of 16 (hexadecimal) indicates …

  9. Attempting to parse an integer from a prompt - Stack Overflow

    Oct 17, 2017 · Strings don't have a .parseInt() method; correct use is parseInt(firstNumber,10). If you open your browser's dev tools the console should show an error on that line.

  10. The JavaScript prompt – Getting user input - WebDevelopersNotes

    Javascript provides two functions to convert this string value to a numeric data type; parseInt () and parseFloat (). The parseInt () converts a string to an integer value while parseFloat () …

Refresh