About 1,800,000 results
Open links in new tab
  1. 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") …

  2. How to convert a string to an integer in JavaScript?

    Obviously, converting to a Number gives you a value that might be a float rather than an integer, so if you want an integer, you need to modify it. There are a few ways of doing this: var …

  3. How do I convert a float number to a whole number in JavaScript?

    Feb 28, 2009 · I'd like to convert a float to a whole number in JavaScript. Actually, I'd like to know how to do BOTH of the standard conversions: by truncating and by rounding. And efficiently, …

  4. Converting a double to an int in Javascript without rounding

    double d = 2.9; int i = (int)d; Debug.WriteLine(i); In Javascript, however, the only way of converting a "double" to an "int" that I'm aware of is by using Math.round/floor/toFixed etc. Is there a way …

  5. Convert a String to an Integer in JavaScript | GeeksforGeeks

    Nov 12, 2024 · These are the following ways to convert string to an integer in JavaScript: 1. Using Number () Method. The number () method converts a string into an integer number. It works …

  6. Cast to Number in Javascript using the Unary (+) Operator

    Oct 5, 2016 · So, to convert a string or a Boolean, or a Numeric String, you can just use +. The Unary (+) can convert string representations of integers and floats, as well as the non-string …

  7. JavaScript casting: Type Conversion in JavaScript explained

    Apr 5, 2021 · JavaScript provides you with built-in global functions and methods to convert data from one type to another. In this tutorial, we’ll look at the following ways of casting type in …

  8. String to Number in JavaScript – Convert a String to an Int in JS

    Aug 30, 2022 · JavaScript has different built-in methods to convert or cast a string into a number. In this article, you will learn some of the built-in JavaScript methods available for converting …

  9. Casting in JavaScript - flaviocopes.com

    Jan 22, 2019 · This are the basics of converting to numbers, but I give a lot more details in how to convert a string to a number in JavaScript. There are other ways to generate numbers from …

  10. Fastest way to cast a float to an int in javascript?

    Dec 3, 2015 · In javascript, what function floatToInt(x) has the fastest running time such that floatToInt(12.345) returns 12? Are there multiple functions that do your job? Just use …

  11. Some results have been removed
Refresh