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--
This article is about how to use the concat method and the splice method in javascript arrays. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
First, concat method 1 directly vs open
2 Code block / / function: merge arrays, merge one or more arrays, return the data after merging arrays without changing the original array; const geyao = ['ballad'] const fuzhu= ["very strong"] console.log (geyao.concat (fuzhu)); console.log (geyao); 3 run results
Summary:
Function: merge arrays, can merge one or more arrays, will return the data after the merged array, will not change the original array
2. Splice method 1 code part const geyao= ["ballad", "very strong", "very handsome"] / / delete 1 element from index 1 let b=geyao.splice (1p1) console.log (b, "later") console.log (geyao, "geyao1") / / from index 2 / delete 0 elements / / then insert "very strong" and "very show" geyao.splice ("very strong", "very strong") "Great") console.log (geyao, "geyao1") / / replace operation: when performing a replace operation The second parameter is the number of elements to be replaced, followed by the deleteCount elements to be replaced. Geyao.splice (2Jing 2, "very impressive", "very nice") console.log (geyao, "geyao1") 2 run result
Thank you for reading! This is the end of the article on "how to use the concat method and splice method in the javascript array". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out 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.