Hi, i am just starting to learn javascript, so i am probably doing something very simple wrong. i have read a lot of articles on maths in java, but cant find anything simple enough for my problem. I am looking for how to get an IF statement to give me the correct output. I am trying to get it to give me a result for a weeks pay, taking that the code worked before i tried to add the IF statement, to make it that if HoursWorked >= 20, the rate of pay would be an extra $2 p/hr. i had the following code to make this work
-
if (HoursWorked >= 20)
-
{
-
WeeksPay = parseFloat(HoursWorked) * parseFloat(RateOfPay + 2);
-
}
-
else
-
{
-
WeeksPay = parseFloat(HoursWorked) * parseFloat(RateOfPay);
-
but, as simple maths will tell you, the answer is not $3800!! can anyone please tel me what silly mistake i am making here please :) sorry to be asking something so simple, but my teacher is away for the weekend and i have just started this module in my course.