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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!