try catch c#

C#
try
{
  int[] myNumbers = {1, 2, 3};
  Console.WriteLine(myNumbers[10]);
}
catch (Exception e)
{
  Console.WriteLine(e.Message);
}var person = {

    firstName: "John",

  lastName : "Doe",

    id       : 5566,

    fullName : function() {

      return this.firstName + " " + this.lastName;

    }

};
 
Source

Also in C#: