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

3.40 Rating (163 Votes )

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

Document Format (2 attachments)

PDF file Icon

635d866b84200_176434.pdf

180 KBs PDF File

Word file Icon

635d866b84200_176434.docx

120 KBs Word File

Students Have Also Explored These Related Programming Questions!