Split string by charcter and store into array
a high-level, interpreted programming language that conforms to the ECMAScript specification. It is a language that is also characterized as dynamic, weakly typed, prototype-based and multi-paradigm. Alongside HTML and CSS, JavaScript is one of the three core technologies of the World Wide Web.[9] JavaScript enables interactive web pages and thus is an essential part of web applications. The vast majority of websites use it,[10] and all major web browsers have a dedicated JavaScript engine to execute it.
Sometimes you might need to create an array from a string with words separated by a colon. There are many ways to accomplish this task and I would like to discuss one of the ways we are using here at Walden Systems, because we believe this is the most straightforward method to create an array from a string.
Strategy to creating an array from a string is straight forward and involves only one step: We will use is the built in JavaScript string function "split( )".
Here is the code:
var some_string = "Mary:had:a:little:lamb"; var string_list = some_string.split( ":") ;
This will result in string_list with the following:
Mary had a little lamb