How to draw a box with different colors among faces

I want to draw a box that has different color per face, and I googled that result showed me to use from geometry.faces[0] to geometry.faces[5] to change the face color, but I tried with the error: geometry.faces is undefined, and I also found out that official docs also don’t have it.
So my question is how to do it, or what is the alternative of old faces property

Here is a live example that demonstrates how to generate face colors for a box:

Face colors are achieved by assigning a single color value for each vertex of a triangle. You have to ensure that no triangles share vertices which is only possible with a so called non-indexed geometry (notice the call of BufferGeometry.toNonIndexed()).