typescript readonly

Solutions on MaxInterview for typescript readonly by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "typescript readonly"
Noelie
03 Aug 2016
1class Octopus {  readonly name: string;  readonly numberOfLegs: number = 8;
2  constructor(theName: string) {    this.name = theName;  }}
3let dad = new Octopus("Man with the 8 strong legs");dad.name = "Man with the 3-piece suit";Cannot assign to 'name' because it is a read-only property.2540Cannot assign to 'name' because it is a read-only property.Try