join() & Array/String Conversion in JavaScript

From the JavaScript Array Methods cheat sheet · Iteration Methods · verified Jul 2026

join() & Array/String Conversion

Convert array to string and vice versa

javascript
// Array to string
[1, 2, 3].join();      // '1,2,3'
[1, 2, 3].join(' - '); // '1 - 2 - 3'
[1, 2, 3].join('');    // '123'

// String to array
'1,2,3'.split(',');    // ['1', '2', '3']
'hello'.split('');     // ['h', 'e', 'l', 'l', 'o']
Array.from('hello');   // ['h', 'e', 'l', 'l', 'o']
🟢 Essential - Common for display and parsing
💡 join() array→string, split() string→array
📌 Default separator is comma for join()
⚡ Use template literals for complex formatting
🔗 Related: toString() for simple conversion

Continue with JavaScript Array Methods

Save the full cheat sheet or work through every related task.

More JavaScript tasks

Back to the full JavaScript Array Methods cheat sheet