🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › split
String.prototype.split() - JavaScript | MDN
The split() method of String values takes a pattern and divides this string into an ordered list of substrings by searching for the pattern, puts these substrings into an array, and returns the array.
🌐
W3Schools
w3schools.com › jsref › jsref_split.asp
JavaScript String split() Method
The split() method splits a string into an array of substrings.
🌐
Medium
medium.com › nerd-for-tech › basics-of-javascript-string-split-method-4647aa1b0f4e
Basics of Javascript · String · split() (method) | by Jakub Korch | Nerd For Tech | Medium
June 20, 2021 - The split() method is used to split a string into an array of substrings, and return the new array. The split() method does not change the original string. The method has two parameters.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-string-split-method
JavaScript String split() Method - GeeksforGeeks
The JavaScript split() method is used to break a string into an array of substrings based on a given separator.
Published   December 27, 2017
🌐
Programiz
programiz.com › javascript › library › string › split
JavaScript String split()
... separator (optional) - The ... Returns an Array of strings, split at each point where the separator occurs in the given string. Note: The split() method does not change the original string....
🌐
Built In
builtin.com › software-engineering-perspectives › split-string-javascript
How to Split a String in JavaScript | Built In
In JavaScript, the split() method allows you to split the string into an array of substrings based on a given pattern. Here’s what you need to know.
🌐
ReqBin
reqbin.com › code › javascript › wyqvcilw › javascript-split-string-example
How do I split a string in JavaScript?
To split a string in JavaScript, you can use the string.split(separator, limit) method. The split() method splits the given string into an array of strings using "separator" as the delimiter.
🌐
Reddit
reddit.com › r/learnjavascript › javascript string method: split, concat, and join
r/learnjavascript on Reddit: JavaScript String method: Split, Concat, and Join
July 27, 2023 -

I'm doing a code wars practice on JavaScript involving the JavaScript methods split(), concat(), and join(). This is the problem:

Implement a function which accepts 2 arguments: string and separator.

The expected algorithm: split the string into words by spaces, split each word into separate characters and join them back with the specified separator, join all the resulting "words" back into a sentence with spaces.

For example:

splitAndMerge("My name is John", " ")  ==  "M y n a m e i s J o h n" splitAndMerge("My name is John", "-")  ==  "M-y n-a-m-e i-s J-o-h-n" splitAndMerge("Hello World!", ".")     ==  "H.e.l.l.o W.o.r.l.d.!" splitAndMerge("Hello World!", ",")     ==  "H,e,l,l,o W,o,r,l,d,!"

This is the code I've made thus far:

function splitAndMerge(string, separator) {
  
  let char = string;
  
  let cap = char.split("");
  
  let combo = cap.join(" ");
  

  return char.split("").join(" ");
}

It splits it up but I don't know how to get it to produce the final results of having each separator be different. Can anyone help?

🌐
TutorialsPoint
tutorialspoint.com › home › javascript › javascript string split method
JavaScript String Split Method Explained
September 1, 2008 - The split method returns the new array. Also, when the string is empty, split returns an array containing one empty string, rather than an empty array. Try the following example. <html> <head> <title>JavaScript String split() Method</title> ...
Find elsewhere
🌐
Sentry
sentry.io › sentry answers › javascript › split a string in javascript
Split a string in JavaScript | Sentry
We can use JavaScript’s String.prototype.split() method. When called on a string, this will split the string at every instance of the provided separator, discard the separator, and return an array of substrings.
🌐
SitePoint
sitepoint.com › blog › javascript › quick tip: how to split a string into substrings in javascript
How to Split a String into Substrings in JavaScript — SitePoint
November 6, 2024 - The split() method divides a string into an array of substrings based on a specified separator and returns the new array. On the other hand, the substring() method extracts characters from a string between two specified indices and returns the ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-index-split-and-manipulate-strings-in-javascript
How To Index, Split, and Manipulate Strings in JavaScript | DigitalOcean
August 24, 2021 - By splitting strings you can determine how many words are in a sentence, and use the method as a way to determine people’s first names and last names, for example. The JavaScript trim() method removes white space from both ends of a string, but not anywhere in between.
🌐
CoreUI
coreui.io › answers › how-to-split-a-string-by-spaces-in-javascript
How to split a string by spaces in JavaScript · CoreUI
September 23, 2025 - Use the split() method with a space separator to break a string into an array of words. const sentence = 'hello world javascript' const words = sentence.split(' ') // Result: ['hello', 'world', 'javascript']
🌐
freeCodeCamp
freecodecamp.org › news › javascript-split-how-to-split-a-string-into-an-array-in-js
JavaScript Split – How to Split a String into an Array in JS
June 16, 2021 - Let's understand how this works with an example. Here is a string created using string literals: ... We can call the split() method on the message string. Let's split the string based on the space (' ') character.
🌐
TechOnTheNet
techonthenet.com › js › string_split.php
JavaScript: String split() method
This JavaScript tutorial explains how to use the string method called split() with syntax and examples. In JavaScript, split() is a string method that is used to split a string into an array of strings using a specified delimiter.
🌐
JavaScript Tutorial
javascripttutorial.net › home › javascript string methods › string.prototype.split()
JavaScript String split(): Splitting a String into Substrings
November 3, 2024 - Use the JavaScript String split() method to split a string into an array of substrings by a separator.
🌐
Flexiple
flexiple.com › javascript › split-a-string
How to Split a String In JavaScript - Flexiple
The Split Method in JavaScript is a powerful tool used to divide a string into an array of substrings. This method returns the new array. Developers often utilize this method to manipulate and extract information from strings based on a specified ...