how do i distroy a game object with a game object

i was woking on a game of a project and i don't know much about javascript so i was wondering how do i use my dodgeball prefab to distroy my target.

if the dodge ball has a rigid body and a collider you can call function OnCollisionEnter() and then send a message to the other object to get destroyed.


   function OnCollisionEnter(collision : Collision) {