How to create a getter function on a javascript object literal #shorts

preview_player
Показать описание
My VSCode Extensions:
- theme: material community high contrast
- fonts: Menlo, Monaco, 'Courier New', monospace
- errors: Error Lens
- extra git help: Git Lens
- tailwind css intellisense
- indent rainbow
- material icon theme
- prettier & eslint
- ES7+ React Snippets

------------

Рекомендации по теме
Комментарии
Автор

I just used this recently in a project
, great video

lastofus
Автор

This is really useful to abstract away the property from the calling logic. The calling code does not need to know if obj.<prop> is an actual property or a getter, because either way the calling code remains the same.

nagarajansubramani
Автор

Dont know javascript still Learning html and css hut you Explain it in a way i really undertsand good job. Pls continue posting these type of videos

filipfilip
Автор

I Like your js videos a lot it helps a lot 😃

kprasannamahesh
Автор

Omg you actually do look a bit like a young Bob Saget XD

Btechdom
Автор

Good thing that we took how to do more advanced things like this in our oop course in the university
Bad thing i wasn't understanding most of it

last.journey
Автор

Cool. And the setter function? Can I use this like useState react hook?

willyhorizont
Автор

I like your videos a lot. Could you tell me what extention you use to show that inline error?

nguyenucthang
Автор

At this point, might as well use a class

thaturi
Автор

i have a question.. what is the point where your app performs better when you just repeat an action instead of having an if check if its necescary.. like for example i have a savestatus variable in my project the i change quite a bit when a user interacts. Instead of just setting it to false everytime tho i have a function that checks if it is false and only sets it to true if needet.. is this better or worse performancewise?

yanikkendler
Автор

I just don't understand why we need to use getter and setters when we can achieve the same thing with regular methods?

patriotir
Автор

So his full name is Bob Sagot, and he is 20 years old 🤔

punkerts
Автор

Can u store it as Json in database and parse to object on fetch?

ianbdb
Автор

What would be the advantage of using a class over this?

osassabi
Автор

Something about the name "Bob Sagot" feels like a joke.

williamrosenbloom
Автор

its just an OOP thing or I'm wrong

bessiekuester
Автор

What getter difference from function object?

bluerose
Автор

This kind of hides the fact that `name` is actually a function. Isn't that bad?

lemonsavery