Can someone explain floating point?

i need help understanding the floating point?

It just means decimal point doesn’t it?

1 Like

i need help creating a decimal number? i looked it goes from 1 to 9 but i need it explain a little more

Hey @chaz899 a decimal is a way of writing a number that is not whole. Decimal numbers are ‘in-between’ numbers. For example, 5.25 is in between the numbers 5 and 6. It is more than 5, but less than 6. There is no limit to how big they are for example 9999.5 and 9.55566677 are both valid. Floating points are basically exactly the same as decimals.

1 Like

thank you for explaining it to me.

whats wrong with my code cmwebby

var ourDecimal = 5.7;

// Only change code below this line

var ourDecimal = 5.7;

ourDecimal.toFixed(2);

Hey @chaz899 can I ask what you’re trying to achieve? The first thing i’ve noticed is that you declare ourDecimal twice - is that something to do with it?

@cmwebby im trying to get past Create Decimal Numbers with JavaScript, i dont know why its not working

Right okay. These are the instructions “Create a variable myDecimal and give it a decimal value with a fractional part (e.g. 5.7).” .

Bascially it is asking you to create a variable called myDecimal which you assign a floating point number to. You were almost there.

You don’t need the toFixed() method line and instead of creating the second ourDecmial variable you can change it to myDecimal. (You only declare a variable with var/let/const once).

Hopefully that helps?

3 Likes

Hi,

Re-read the instructions until you fully understand them (just the bit under the heading instructions) and you might see your error.

JavaScript can be very confusing at first so I found in the beginning that taking time to really really understand what was being asked by breaking the instructions down line by line and also reading the expected outcomes / tests at the bottom really helped me through.

Cheers

Mark

1 Like

thank you for explaining, i will listen to both of you

1 Like

Agree so much with this. I find it so much easier knowing what I’m expected to output.