In ThreeJS I can create objects like this:
const geometry = new THREE.BoxGeometry( 1, 1, 1 );
const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
const cube = new THREE.Mesh( geometry, material );
scene.add( cube );
Of course, this is a bit hard to visualise, so we can use the https://threejs.org/editor/
Maybe I'm missing something but I can't find a way to convert a model created in the editor to javascript directly? I only see options for exporting to JSON or 3D object files. (see screenshot).
My end goal is to be able to create the same object lots of times by code, with little variations. I just use the editor to get a starting point.