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
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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
