In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail what the stack methods of JavaScript are, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
1. Push receives any number of parameters.
Add one by one to the end of the array and return the modified array length.
2. Pop removes the last item from the end of the array.
Lower the value of the array, and then return to the removed item.
3. Shift removes the first item in the array and returns it, reducing the length of the array by 1.
4. Unshift adds any items at the front of the array and returns the length of the new array.
Example
Var colors = new Array (); / / create an array var count = colors.push ("red", "green"); / / push in two items alert (count); / / 2 return array length var item = colors.pop (); / / get the last item alert (item); / / "green" alert (colors.length); / / 1 var item1 = colors.shift (); / / get the first alert (item1) / / "red" alert (colors.length); / 0 var count1 = colors.unshift ("red", "green"); / / the array pushes forward two items of alert (count1); / / 2 the stack methods of JavaScript are shared here. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.