split vector3 coordinates in to x,y,z

hey i need to get the x,y and z values of the coordinates separately so that i can modify them and get the new coordinates for position. can u tell me hoew to implement that in javascript.the code that i am currently using, displays the coordinates of a moving object.i need to separate them and modify them like x+4 or y-3 and then use them in transform.position.thanks in advance

my current code:-
//Unity will constantly check the position of the GameObject.function Update () {

//Creates a variable to check the objects position.

myPosition = transform.position;

//Prints the position to the Console.

Debug.Log(myPosition); }

First off, make sure to keep your posts formatted. People don’t want to read code when it just looks like sloppy plain text.

Second, the solution is super simple.

myPosition.x += 4
myPosition.y -= 3

You can also add multiple Vector3 objects together.

newPos = Vector3(4, -3, 0);
myPostion = transform.position;

finalPosition = newPos + myPosition;


finalPosition = transform.position + Vector3(4, -3, 0);

I would also encourage you to spend time reading through documentation on the Unity wesbite. A quick server for Vector3 would have shown you everything I just posted.