In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to convert strings into arrays in javascript". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "how to convert strings into arrays in javascript" together!
The method of converting a string into an array in javascript: 1. Cut the string into several strings according to a certain character;2. Return it in array form, such as [var s = "abc,abcd,aaa"; ss = s.split(",");].
Operating environment: windows 10 system, javascript 1.8.5, thinkpad t480 computer.
Small partners who have learned javascript should have encountered the case of array and string conversion, and today Xiaobian will share the method of array and string conversion, as follows:
1. Array to String
You need to concatenate the array elements into a string with a character. The example code is as follows:
var a, b;a = new Array(0,1,2,3,4);b = a.join("-");
Second, string to array
The implementation method is to cut the string into several strings according to a certain character and return them in array form. The example code is as follows:
var s = "abc,abcd,aaa";ss = s.split(",");//Split at each comma (,). Thank you for reading, the above is "javascript string how to convert to array" content, after the study of this article, I believe we have a deeper understanding of how to convert javascript string to array this problem, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
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.