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

    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);

  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.

  3. parseInt() - JavaScript | MDN - MDN Web Docs

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

  4. JavaScript Number parseInt() Method - GeeksforGeeks

    May 31, 2024 · The parseInt method parses a value as a string and returns the first integer. It accepts a string argument and optional radix parameter, defining the numeral system base. …

  5. alert() prompt() confirm() and parseInt() methods in JavaScript

    The prompt method in JavaScript is used to take input from the user. The confirm () method displays a dialog box with a specified message, along with an OK and a Cancel button. A …

  6. The JavaScript prompt – Getting user input - WebDevelopersNotes

    The parseInt() converts a string to an integer value while parseFloat() parses the string converting it to a floating point number. Note: An integer is a whole number without any fractional part …

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

    Mar 28, 2014 · var a = parseInt(prompt("Enter first number")); var b = parseInt(prompt("Enter second number")); alert(a + b); You use the parseInt before the prompt because its will take as …

  8. Understanding parseInt in JavaScript: Usage, Quirks, and Best …

    Oct 5, 2023 · parseInt is a function in JavaScript used to convert a string into an integer. It parses through the string until it reaches a character that isn't a numeral, returning the integer formed …

  9. 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 …

  10. Does prompt always come back as a string that you have to convert?

    var num = prompt (“What is your age?”); num=parseInt (num); Yes, except when it doesn’t. prompt() always returns a string, whether numbers or characters, with one exception. When …

  11. Some results have been removed
Refresh