Skip to main content

All Questions

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 + ...
Naiem's user avatar
  • 11
-2 votes
2 answers
62 views

Numerical transformation in javascript and math operation [duplicate]

Here is the code: alert(typeof(+"13t")); alert(1 + (+"13t")); Why in the first line the output is "number" And in the second line the output is "NaN"??
Experimenter's user avatar
  • 2,486
-1 votes
3 answers
2k views

convert spelled out numerals ( twenty two ) to digits ( 22 )

I'm trying to convert spelled out numeric strings into strings of digits / numbers. I managed to do the opposite, below, but when I tried to reverse it, I didn't work so well ( it returned undefined ...
wordSmith's user avatar
  • 3,183
0 votes
2 answers
2k views

Javascript: Adding $ + cents [duplicate]

A short while ago I had posted about adding a comma to the value once it reached a certain number (1000). At the moment, the value is going up $11 every second, although I would like to implement a ...
tebrown's user avatar
  • 153
2 votes
3 answers
3k views

Javascript: Adding comma to number

When the number reaches 1000 it adds the comma and becomes like so 1,000 although once it implements the ',' it then resets back to 12 where it should carry on. Here is my jsFiddle: http://jsfiddle....
tebrown's user avatar
  • 153
147 votes
5 answers
166k views

How to sort numbers correctly with Array.sort()? [duplicate]

In multiple browsers, the following code doesn't sort the numbers correctly: a = new Array(); a.push(10); a.push(60); a.push(20); a.push(30); a.push(100); document.write(a.sort()) It returns 10,100,...
Some Guy's user avatar
  • 16.2k