Write and test a function named getDollarAmt that accepts a string in currency format, and returns a
Fantastic news! We've Found the answer you've been seeking!
Question:
Write and test a function named getDollarAmt that accepts a string in currency format, and returns a number representing the value. For this function, you must use a for loop that processes the string.?
?
Examples:?
?
getDollarAmt('$120.00') => 120?
getDollarAmt("$23.98") => 23.98?
typeof(getDollarAmt('$1.00')) => number?
Please do not give me this code
function getDollarAmt(s){
return parseFloat(s.substr(1,s.length));
}
Need the code that use a for loop that processes the string.
Related Book For
Computer Organization and Design The Hardware Software Interface
ISBN: 978-0124077263
5th edition
Authors: David A. Patterson, John L. Hennessy
Posted Date: