In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to use entries (), keys () and values () methods in ES6". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn how to use the methods of entries (), keys () and values () in ES6.
Entries (), keys () and values ()
ES6 provides three new methods-- entries (), keys (), and values ()-- for traversing arrays. They all return a traversal object that can be traversed with a for...of loop, except that keys () is the traversal of the key name, values () is the traversal of the key value, and entries () is the traversal of the key-value pair.
For (let index of ['asides,' b'] .keys ()) {console.log (index);} / 0 / / 1 for (let elem of ['asides,' b'] .values ()) {console.log (elem);} / /'a' / /'b' for (let [index, elem] of ['asides,' b'] .values ()) {console.log (index, elem) } / / 0 "a" / / 1 "b"
If you do not use a for...of loop, you can manually call the next method of the traversal object to traverse.
Let letter = ['averse,' baked,'c']; let entries = letter.entries (); console.log (entries.next () .value); / / [0,'a'] console.log (entries.next () .value); / / [1,'b'] console.log (entries.next () .value) / / [2,'c'] these are all the contents of this article entitled "how to use the entries (), keys () and values () methods in ES6". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.