how destroy a object with press a button

hi how destroy a object with press a button ? can you do the java script please? thanks brofist

var someObject : GameObject;
function Update () {
if (Input.GetButtonDown (“Fire1”)) {
Destroy(someObject);
}
}