javascript mesh creation

can someone direct me to a tutorial on how to make a cube with code. to be clear im tking about using traiangles and verticies to make a cube.
thanks for the help

Some links that may help:

http://answers.unity3d.com/questions/211356/procedural-cube.html

http://forum.unity3d.com/threads/43421-Create-a-dynamic-mesh-(cube)

Not a cube, but nice mesh creation code:
http://wiki.unity3d.com/index.php?title=CreatePlane