In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Xiaobian to share with you how to use the slice method and join method in javascript array, I believe most people do not know how to use it, so share this article for your reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!
1. slice method 1 editor section
2 Code parts map const geyao=["geyao","geyao1","geyao2"]//Required. Specify where to start selecting. If negative, it specifies the position from the end of the array. That is,//-1 refers to the last element,-2 refers to the penultimate element, and so on.// Optional. Specify where the selection ends. This parameter is the array index at the end of the array fragment. If this parameter is not specified,//then the split array contains all elements from start to end of the array. If this argument is negative, then it specifies elements counting from the end of the array.// The first is the start index and the second is the end index//(leaving the original array unchanged) let geyao1=geyao.slice(1,3) console.log(geyao,"later") console.log(geyao1,"later") //where to start let geyao2=geyao.slice(1) console.log(geyao,"later") console.log(geyao1,"later")3 Run results
Summary:
Required. Specify where to start selecting. If negative, it specifies the position from the end of the array. That is,-1 refers to the last element,-2 refers to the penultimate element, and so on. Optional. Specify where the selection ends. This parameter is the array index at the end of the array fragment. If this parameter is not specified, the partitioned array contains all elements from the start to the end of the array. If this argument is negative, then it specifies elements counting from the end of the array. The first is the start index and the second is the end index (leaving the original array unchanged).
2. Join Method 1 Editor
2 Code parts var elements ="'ballad ','very strong',' excellent'"]; console.log (elements.join()); console.log (elements.join ('')); console.log (elements.join ('-'));3 Run results
The above is " javascript array slice method and join method how to use" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to 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.