Create edges for vertices(JS)

In my mesh I'm creating vertices in different parts of the mesh, but I want to be able to create or connect does vertices to have an edge and be able to also quit some connections so like that only have 2 vertices without connecting each other. So my question is, how can I do something like this(i am asking for code using JavaScript)?

You "connect" vertices by making triangles. However, zero-area triangles, that is, "edges", won't display. Vectrosity provides a solution to visualize edges; my guess is it's using very thin meshes whose vertices are calculated in camera space, but I don't know for sure. It's low-priced so you may want to just buy a license.