All Questions
9 questions
2
votes
3
answers
71
views
Advice on how to resolve an issue with extracting only numbers from a string using JavaScript
I'm new to stackoverflow and would appreciate some advice to help me solve this problem.
I have two strings that I want to extract numbers from
String 1 = "12.3,Name1,3,4,Name2,35,Name3" ...
0
votes
2
answers
1k
views
shortcut symbol for converting toString [duplicate]
As you know, if I want to the get numeric value of a variable (e.g. $event) I'd do:
<ax-text-box (valueChange)='documentSearchItem.fromPrice=(+$event)'></ax-text-box>
I add a + to do ...
0
votes
3
answers
914
views
why javascript show string all arithmetic operation?
as you show below, when javascript doing an arithmetic operation all value concatenation with the string it shows a string value but I have some confusion...
var x = 10;
var y = 20;
var sum = x + ...
-7
votes
2
answers
650
views
javascript numeric string reverse sort doesn't work properly [duplicate]
I have an array ["4", "2", "5", "3"], why the sort function works properly but not the reverse one?
["4", "2", "5", "3"].sort(); //gives me ["2", "3", "4", "5"]
["4", "2", "5", "3"].reverse(); //...
0
votes
2
answers
56
views
Javascript: What is best approach to generate unique numeric string? [closed]
What is best approach out of below options:
option 1:
var d = new Date();
uniqueString = d.getTime();
option 2:
uniqueString = Math.random();
-1
votes
3
answers
43
views
How To Check Value Of String
<span id='amount'>0.00000000</span>
<a class='button-withdraw' id='tombolco' href='#'>Checkout</a>
<script>
var amount = document.getElementById("amount").innerHTML;
...
0
votes
2
answers
62
views
PHP string with a number range converted to number automatically in javascript
I have a php variable as below:
$starting_package_wedding = $_GET['starting_package_wedding'];
which outputs
string '75001-90000' (length=11)
Now I have a javascript in which I will need the the ...
4
votes
3
answers
14k
views
How to convert String variable to int in javascript?
What is the correct way to convert value of String variable to int/numeric variable? Why is bcInt still string and why does isNaN return true?
bc=localStorage.getItem('bc');
var bcInt=parseInt(bc,10);...
3
votes
1
answer
834
views
how exactly do Javascript numeric comparison operators handle strings?
var i = ['5000','35000'];
alert((i[0] < i[1])?'well duh!':'fuzzy math?');
alert((Number(i[0]) < Number(i[1]))?'well duh!':'fuzzy math?');
What's happening here? In the first alert, the text ...