Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript The Solution

Michael Harrison
Michael Harrison
30,900 Points

Division in JavaScript

Is all division in JavaScript floating-point division? I'm coming to this from a Java and C# background.

1 Answer

Steven Parker
Steven Parker
231,269 Points

Java and C# are similar to each other in many ways, but JavaScript is rather different from both of them. You'll do well to avoid making assumptions about JavaScript based on what either of those languages do.

The default JavaScript Number type is double-precision 64-bit binary format IEEE 754 value, though there are some other types that can be explicitly declared. What an operator does is based on the type(s) it is acting on, so for default numbers division is double-precision floating point.