Zero Values in Go
Most programming languages have a feature called “default values”. A default value lets you choose the initial value of a variable, a class field, or a function parameter. If the caller does not provide a value, the default is used. In TypeScript, default values look like this: class Person { constructor(private first_name: string = "John", private last_name: string = "Doe") {} getName(): string { return `${this.first_name} ${this.last_name}` } } console.log(new Person().getName()) // "John Doe" class Person { constructor(private first_name: string = "John", private last_name: string = "Doe") {} getName(): string { return `${this.first_name} ${this.last_name}` } } console.log(new Person().getName()) // "John Doe" Both constructor parameters have defaults, so new Person() works without any arguments. Without the defaults, TypeScript would not compile that call. In plain JavaScript there is no compiler to stop you, so the same code would print "undefined undefined". ...