Threejs, latest version. Make triangle geometry

I am trying to make a triangle, after updating to the latest Threejs.

Where I am making the geometry for the triangle, I can put:

var geometry=new THREE.BoxBufferGeometry(1000,1000,1000);

And then it draws a box perfectly.

But now I want to draw a triangle. So I googled triangle and wound up here:

Going by that I comment the box way to make the geometry and replace it with the following:

var v1=new THREE.Vector3(0,1,0);
var v2=new THREE.Vector3(0,1,0);
var v3=new THREE.Vector3(0,1,0);
var geometry=new THREE.Triangle(v1, v2, v3);

But it gives me error:

Uncaught TypeError: can't convert undefined to object

But if I skip THREE, in THREE.triangle, I get

Uncaught ReferenceError: Triangle is not defined

How should one make the triangle geometry?

I realize I should go under the geometries section.
But there is no triangle geometry.

Try var geometry = new THREE.BufferGeometry().setFromPoints([v1, v2, v3]);

1 Like