Finding the number of boxes that can fit into a truck using JavaScript
You have a bug in the output: your whole program always does the equivalent of

alert("You can fit up to 1 box into the truck");


One way to prevent that kind of error is to use "Yoda conditions", which put the constant first:

if (1 == boxCount)


I think boxCount is a slightly better name than boxNumber, which sounds like it could be referring to the nth box.

Your if-else brace style is probably one of the rarest and least favoured ones possible.  The braces, being aligned with neither the outer level nor the inner level, create visual clutter.

I'd actually prefer to use a ternary expression instead of repeating the entire statement:

alert("You can fit up to " +
      boxCount + (1 == boxCount ? " box" : " boxes") +
      " into the truck");




totalHeight, totalWidth, totalLength are misnamed, in my opinion.  You're not totalling anything. Furthermore, the values that you store in them are not lengths (with metres as the unit), but unitless numbers.  I think heightMultiples, widthMultiples, and lengthMultiples would be more appropriate.

In real life, the problem that you are trying to solve is trickier than that.  You have the two options for orienting each box, assuming that the boxes need to stay upright.  If you are allowed to tip boxes over on their side, then you have six possible orientations altogether.  You would have to try all allowable orientations for optimal packing.

On the other hand, if the boxes are strapped to pallets, you may have no choice at all in the orientation, due to the way the forklift needs to enter the truck.

Fortunately, packing rectangular prisms is a relatively simple problem, compared to other objects. ☺