JavaScript How to Calculate Tax Rates into Prices

preview_player
Показать описание
Learn to calculate tax rates into prices using JavaScript.
Рекомендации по теме
Комментарии
Автор

Awesome! and so quickly done. Appreciate it. I needed both ways.

Joehle
Автор

Awesome! Adam I've been learning a lot from you, would you mind doing something with chatGPT?

iservng
Автор

Good one Adam, but I kept wondering what "1" is doing in the equation.

naziruadam
Автор

Oh I get it 😁Without the "1" the equation will simply return the fraction of the roomprice. XD. Thanks once more!

naziruadam
Автор

How would you do it if you wanted to do a calculation script for VAT prices and regular prices on a object and then let the user type in random number for the VAT and the price object, and the amount of objects and then get a seperate calculation on an object VAT including price and the original price? Hope this wasn't too confusing of a question. I've been stuck with a assigment for this for a long while now. Cheers!

nana-channana-chan
Автор

roomprice should be in cents aka roomprice * 100.
The reason for that is because JS is using IEEE 754 standard for its Number type, that is not precise and with a bigger number, we can go around that.
After that, when you Math.round, you can divide by 100. So in summary:

// lets say you want to add 17%
let total = Math.round((roomprice * 100) * (1.17)) / 100

JohnSmith-gugl
Автор

Hello, awesome channel and content. Could you do a tutorial for making an omeggle like website? Having random users match and text or video each other?

bobo
Автор

How can i make a pricing or billing system that changes the amount of the price of travelling from one country to another according to the distance it travels

For example a ticket from america to china is not the same price as a ticket from america to saudia arabia

awabmahdi