Is there a method with javascript that can return n
sequences of string that form a part of a larger string?
For example, in a sequence like:
Paris, Italy, London, Perth, Moscow, Wellington
How could I get n
word-pairs where n = 2 in this example. The output would be:
Paris, Italy
London, Perth
Moscow, Wellington
Is there a built in method with Javascript that could help me achieve this?