In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what are the new features of JavaScript engine V8 8.5". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the new features of JavaScript engine V8 8.5".
Promise.any
Promise adds an any method that receives an array of Promise, and when one of the Promise in the array is fulfilled, the Promise it returns is returned.
Const promises = [fetch ('/ endpoint-a'). Then (() = >'a'), fetch ('/ endpoint-b'). Then (()) = >'b'), fetch ('/ endpoint-c'). Then (() = >'c'),]; try {const first = await Promise.any (promises); / / any Promise is fulfilled status console.log (first) / / → 'b'} catch (error) {/ / all Promise are rejected console.assert (error instanceof AggregateError); / / reject result array console.log (error.errors);}
If all input Promise is rejected, Promise.any will return an exception of type AggregateError, and the errors property of this object contains all Promise rejected properties.
Be careful not to be confused with the Promise.race method, the race method is that any Promise in the array is resolved or rejected, while the any method must be resolved, and an exception is thrown if all are rejected.
String.prototype.replaceAll
String.prototype.replaceAll provides an easy way to replace all matches of substrings without having to create a global RegExp.
Look at the following example. In the past, to replace all the + in queryString, you need to create a global regular:
Const queryString = 'qroomquerystringparametersparameters` queryString.replace (/\ + / g,'')
Now you just need to use the replaceAll method:
QueryString.replaceAll ('+',''); logical assignment operator
The logical assignment operator is a new compound assignment operator, which can take the logical operation & &, | or?
X & & = y holding / equivalent to x & & (x = y) x | | = y holding / equivalent to x | (x = y) x?? = y leading / equivalent to x? (X = y) Thank you for your reading, these are the contents of "what are the new features of JavaScript engine V8. 5?" after the study of this article, I believe you have a deeper understanding of what the new features of JavaScript engine V8. 5 have, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.