Set is a way to have a property that when is updated do some additional logic.
- So a setter or the set keyword in our class … is pretty much the exact opposite of what a get is. … Well, a get is there to get data, a set is there … to update data while still provides some additional logic. … Now, let's say when we set our isSent property, … we wanted to actually have a new property … here called delivery date. … And delivery date will be the time associated … with when that isSent property is then true, … meaning we just sent it. … So let's set this equal to date. … Now, if we wanted to convert this to a setter getter, … we can do that pretty easily … and still have this functionality, right? … It's going to be a bit of a hassle to every time we say, … hey, go ahead and isSent update delivery date. … Now, let's have our setter do that for us. … So we're going to introduce some concepts here, … such as access modifiers, … but I'm introducing them a little bit earlier. … So you can see a very practical approach … of how you might use this. … So when you're going to use a get value to return isSent …
Skill Level Intermediate
TypeScript: Upgrades and Featureswith Emmanuel Henri1h 15m Advanced
TypeScript for Node.js Developerswith Emmanuel Henri1h 2m Intermediate
1. Classes in TypeScript
2. Inheritance in TypeScript
3. Access Modifiers in TypeScript
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.