Well, when you have the percentage, such as 0.056034, you multiply it by 100 to end up with a visual representation of the percentage, that being 5.6034%
@Paul_Wilkins sorry to sound so noob, whats the ,2 for and what does comma (,) do in javascript?, plus when i do Math.Fixed(), it says its not a function?
The comma 2 is for a second parameter to the toFixed function, specifying to how many decimal places we want our final percentage value to be shown as.
The Fixed() part has been fixed to be toFixed() instead, no pun intended.
There are a few different ways of using it. The toFixed function is a part of the Number object. The toFixed function gives a string version of the number, so that some formatting can be applied. The argument that you give to toFixed says to how many decimal places the string version of should be shown as.
@Paul_Wilkins I get a seriously big amount. like 125789.60%, shouldnât be the APR just something atmost like 5.99%, i mean the value such big is like a APR rip off. lol
@Paul_Wilkinshere@Dormilich is my complete code, wonder why my code gives a APR of 5.69821268% etc. I pasted it in pastebin as i didnât wanted to be indexed. [ot]Sorry, i created a new thread, was checking + reply as linked topic link[/ot]
With the code that you have just provided, I see where you are calculating the total repayable, but I donât see where you are calculating the APR rate.
Youâve mentioned this a few times, and I think that you may need to learn more about indexing.
Google indexes pastebin along with other websites. This can be demonstrated with a few well-chosen keywords that are somewhat unique to your code, such as:
[ot] I thought, they delete that after expiration date[/ot], I am kind of lost in the APR, donât know what baserate is if i apply the code you mention and some other variables are keeping me lost (which one should i replace with mine)
Off Topic:
what you think of the code i wrote, is it clean and good.
checkboxes do not restrict how many you click => use radio buttons with a common name
then you can save the percentages in each radio button
rating is already a number, no need to use partseInt() on it. for number you would use Math.floor() / Math.ceil()
the last 2 lines of at the broker fee are identical => move that out of the condition
the second condition at the broker fees do not need an extra condition since the current condition is the only possible condition left => use else instead of else if
select elements have a value property themselves, no need to use selectedIndex
Sorry no. I must sleep now, but tomorrow Iâll spend a few hours going through the problems, and what can be done about them.
Would you mind easing the burden by providing the html form code that goes with the code, so that I donât end up creating a separate version of it? That will help to ensure that my feedback is as relevant to your situation as possible.
@Paul_Wilkins I was able to find a example, that somehow works. But, it gives me negative apr if my rating is poor and amount is 20000 over year of 16 years. Like it gives me negative values. wonder why
For that, I would need to understand the APR formulas that you are wanting to use.
Can you please update me (and perhaps the rest of us) on the math of what is supposed to happen, based on things like the rating and the number of years?