Soon the new version of ECMA Script will become standard in few months. So let's take a glimpse at the features that will be part of ES2022.
...
For further actions, you may consider blocking this person and/or reporting abuse
I will miss arr[arr.Length -2]
True 😅
... or not! 😅
I didn't like this one. It could mislead me sometimes 😂/
Don't worry, you can still use it if you want ;)
hhhhhhhhhhhhhhhhh
so true hahahahah
Ohh wow
Thanks👍
What is
error.cause
for?Normally, the cause of the error is what I would put in the error message. I mean, what else would you put there?
Why do we need another field for that?
I don't know of any other language that has two text messages in the same exception. What for? 🤷♂️
The error message might sometimes be used for a public-facing message. You could then put more technical information in the cause as well. That's my guess, at least.
Ah, mystery solved!
2ality.com/2021/06/error-cause.html
It's for chaining errors - like the "inner exception" you have in many other languages.
Because you can throw anything in JS, the property type isn't specified as Error - but the intention is similar.
Thanks for attaching this link for reference. 🙂
The way this would be super helpful is in deeply nested functions with chained errors.
Like if we have mutiple try catch block inside a deeply nested function so we pass the string as the purpose of that block and cause as the argument of catch block. For example:
That sounds unlikely?
At least, I've never heard of anyone using exceptions for display purposes - exceptions generally do contain technical information, they are usually intended for developers, not for users. How would you deal with localization, for instance... That's just not what exceptions are for...
I may be wrong but I do not think this is correct "For static data we have Static fields and Static Blocks that are executed every time a new instance is created.".
Static blocks are evaluated once during Class definition not every time a new instance is created.
When a new instance is created, it is the code in the construction that is executed.
Yes you are right, static blocks are executed when a class is created not in case of instance. Updated the statement.
Thanks👍
Informative post, thank you. There is apparently an error in the output listed for
matchObj.indices.groups
however which should instead by an object keyed by group.Hey,
Actually, I included the full output which is an array having an object keyed by group.
I should’ve included just the groups output for more clarity.
Thanks for pointing out buddy!😀👍
This is what I see as the output showing on the page:
There's no object showing there...
I was referring to the snippet just above this one 😅
I should’ve returned the full object instead of returning just the indices.
Updated the post. Thanks 👍
Top-level await is what I've been waiting for forever!!
Can't wait for these to come out!!
flatMap operator is alternative but sure its nice to have
I'm very excited for being able to use the top level await examples you gave (minus the lodash part).
😁
Can you give an example as of why?
/ C# dude here
superb post, thanks.
🙂
Thank you for sharing the post. :)
🙂
Thanks for the breakdown. Nicely written too 👏
Thanks👍
Short and crisp. Thumbs up for that but one minor feedback though, it would have been great if practical/possible use cases around it would have been shown or told on top of the syntax. Cheers!
Thanks for sharing the feedback. Will definitely work on it. 🙌
Excellent summary Tx.
Thank you! 👍🏻
Great post Jasmin! Very informative.
Thank you! 👍
Laughing in typescript
(JK, very interesting !)
Dear Jasmin Virdi,may I translate your all dev articles into Chinese?I would like to share it with more developers in China. I will give the original author and original source.
Hey,
Sure please go ahead. Do tag me in the post so that I can see it too!👍
Excellent article! Thanks!
Wow Thanks ❤️
🙂
I had so much fun learning with you. Your lessons were very insightful and interactive, so thank you.
Glad to hear 😄
Thanks for going through my articles👍
Really useful, honestly learned new features. Thanks
Thanks👍
Thanks a lot, appreciate your time
🙂
Great job jasmin.. its very nice for students like me..
Thanks 👍
Hey,
It is index based that is why the element at 3rd index would be 4 as per what is mentioned in the example 🤔
That's a nice summary please looking forward to see you around TC39 Educators call @jasmin github.com/tc39/js-outreach-groups
Hey,
Thank you soo much. Can you please share more details about this?😅
Hello, you can fill a form there github.com/tc39/js-outreach-groups then I can invite you for our next meeting :)
Thank you so much!
Filled the form!🙂
In all these, I guess I will be using
Array.at(index)
more.Hi jess hun how are you?
All we need is actually implementation of ES4. That way, not only it solves many problems, we also dont need TypeScript__
All we need is actually implementation of ES4. That way, not only it solves many problems, we also dont need TypeScript
Great summary. Thanks
why did they chose # to declare private properties? I don't love the syntax tbh but I guess is better than nothing
I'm still waiting for the pipe operator 🙈🙈
pipe? I was sure it would be there ....
Looks more like an incremental upgrade, nothing revolutionary here ...
Thanks for writing this 😘
I really love your theme 🤩🔥, please what theme is it?
Thank you 👍🏻
I have used JS code blocks which does the Javascript style highlighting.
So, we can use await in any where, no need to wrap in an async method?
await without async functions 🤪 that's really a good one.
Also can't wait for the array find-from-last object.
Amazing
Array.at(-1)
how to access a private field from outside of the class ? wazifa to marry someone you love
hi there?
bruh, isn't .at(3) literally the same thing as [3]
i swear to god js is just becoming the huge pile of this random stupid functions