.join() Method
Use the .join()
method when you want to delimit an array. Delimiters are used as boundaries to separate things. Punctuation marks are commonly used as delimiters. Here's an example:
var meals = ['breakfast', 'lunch', 'dinner'];
console.log(meals.join(' AND '));
Output
breakfast AND lunch AND dinner
See how the word AND
is used as a delimiter to separate each of the meals?
Last updated