Nicely put, I can't agree with you more. The greatest relief in fact, if any, about the ES6 classes syntax, or the TypeScript syntax, is thankfully -- as you rightfully pointed out -- that you can still write simply and readably. Albeit it also can be turned into something really hardcore that looks half-intellectual and half-mangled. I really don't like the people who write such codes thinking that it's your fault you won't understand it.
So I guess I had two main points which is that readability must always be preserved. And yes related to the first love, still can't let go 😂 -- that it should have been proto instead of class, and create instead of new.
Nicely put, I can't agree with you more. The greatest relief in fact, if any, about the ES6 classes syntax, or the TypeScript syntax, is thankfully -- as you rightfully pointed out -- that you can still write simply and readably. Albeit it also can be turned into something really hardcore that looks half-intellectual and half-mangled. I really don't like the people who write such codes thinking that it's your fault you won't understand it.
So I guess I had two main points which is that readability must always be preserved. And yes related to the first love, still can't let go 😂 -- that it should have been
proto
instead ofclass
, andcreate
instead ofnew
.Wonderful comment, thanks.
Btw, your code gives the error of
Cannot invoke an object which is possibly 'undefined'.
onobj.fullName()
. Any idea how to fix that?Also, why do you need to wrap it in
#UsingThePersonClass()
.The wrapping was just to show how to use the Person class.