Trying to create a javascript object

Trying to create a javascript object but doesn’t work.

var x;
var y;

pos=new Object();
pos.x = 0;
pos.y = 0;

Neither does this.

function Pos(x:int, y:int)
{
this.x = x;
this.y = y;
}

var pos = new Pos(0,0);

Unity gives an error saying it’s void.

Try this. I’ve commented on the code a bit, // means nothing will happen with that line.

var x = Vector3(1,1,1);

// you need to say var x is something, so here say it is a Vector 3.

function Start (){
// you need to put a function in and use an Instantiate to make something. 
Instantiate (x, transform.rotation);
}

That will make an object at the coordinates of x.