Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 440 Bytes

Convert a String to a Number!.md

File metadata and controls

21 lines (16 loc) · 440 Bytes

Description:

We need a function that can transform a string into a number. What ways of achieving this do you know?

Note: Don't worry, all inputs will be strings, and every string is a perfectly valid representation of an integral number.

Examples (input --> output):

"1234" --> 1234
"605"  --> 605
"1405" --> 1405
"-7" --> -7

Solution:

const stringToNumber = function(str){
  return Number(str);  
}