convert code C# to java..

convert the following c# code by converting into js…?

RaycastHit hit = new RaycastHit();
 Ray ray = new Ray();        
 ray = Camera.main.ScreenPointToRay(Input.mousePosition);
 
 if (Physics.Raycast (ray, out hit)) 
        {
            Debug.Log("pew pew");
 if (hit.collider.gameObject.name.Equals("Cube"))   
            {
 
                Debug.Log("hello");
               //gameObject.SendMessage("gotoBrooks");
            }

}

var hit : RaycastHit = new RaycastHit();
var ray : Ray = new Ray();

 if (Physics.Raycast (ray, hit)) {
     Debug.Log("pew pew");

     if (hit.collider.name.Equals("Cube")){
          Debug.Log("hello");
          //gameObject.SendMessage("gotoBrooks");
     }
}