Three.js editor can’t move my Box

Hi!
I’m trying to make my box move, but if I use

if(event.which==879 {
this.position.z+=0.01;
}

it tells me following:

undefined is not an object (evaluating 'this.positon.z') update@
update@[native code]
dispatch@blob:https://threejs.org/09a1f96b-1617-4997-9a6f-434fbdd4f56e:144:15
animate@blob:https://threejs.org/09a1f96b-1617-4997-9a6f-434fbdd4f56e:158:13
onAnimationFrame@blob:https://threejs.org/070fea21-3a74-4527-94bf-62e4c20e4169:27391:59
onAnimationFrame@blob:https://threejs.org/070fea21-3a74-4527-94bf-62e4c20e4169:12494:16

I also tried

if(event.which==879 {
this.translateZ(0.01);
}

result:

Can’t find variable: cube

I would be grateful if someone could help me.

The event object in the default update() function contains a custom event object holding the elapsed time and time delta value. If you need event data from the keyboard, use a separate event listener in the script like so:

function keydown( event ) {

	if ( event.code === 'KeyA' ) {

		this.position.x += 0.1;

	}

}