var array = string.split(',');
MDN reference, mostly helpful for the possibly unexpected behavior of the limit
parameter. (Hint: "a,b,c".split(",", 2)
comes out to ["a", "b"]
, not ["a", "b,c"]
.)
More Related Contents:
- Is there a built in way to convert a comma-separated string to an array?
- Split large string in n-size chunks in JavaScript
- How can I split a string into segments of n characters?
- Split a string based on multiple delimiters
- String split returns an array with more elements than expected (empty elements)
- Unicode string with diacritics split by chars
- How to count the number of lines of a string in javascript
- Regular expression to get a string between two strings in Javascript
- Regular Expression to get a string between parentheses in Javascript
- Insert a string at a specific index
- How to use split?
- Optimum way to compare strings in JavaScript? [duplicate]
- How to create streams from string in Node.Js?
- What does ${} (dollar sign and curly braces) mean in a string in JavaScript?
- How to insert variables in JavaScript strings?
- JavaScript replace() method dollar signs
- How can I use jQuery to style /parts/ of all instances of a specific word?
- Is there a JavaScript strcmp()?
- How can I insert new line/carriage returns into an element.textContent?
- What’s the point of new String(“x”) in JavaScript?
- How to remove part of a string?
- Javascript unicode string, chinese character but no punctuation
- Split JavaScript array in chunks using Lodash
- JavaScript adding a string to a number
- javascript split string by space, but ignore space in quotes (notice not to split by the colon too)
- Extract the text out of HTML string using JavaScript
- What is the difference between ‘ and ” in JavaScript?
- How do you split a javascript string by spaces and punctuation?
- How to add spaces between every character in a string?
- javascript – Convert array to string while preserving brackets