JavaScript.
Use the Console in the Developer Tools in the Chrome browser to create the"function myNumber(s)" that converts a string into the number. Please implement the conversion using some algorithm, instead of just call built-in function "Number" or other functions. I expect that the code will need to loop through the string element by element.
The following are the expected outputs in Console:
> myNumber('123.456')
123.456
> myNumber('1234567890')
1234567890
> myNumber('1')
1
> myNumber('abc')
NaN
> myNumber('.12345')
0.12345
> myNumber('12345.')
12345