Converting Array to a String[ .tostring() ] method

 1. Using the .tostring() method


// Converting Array to a String
// 0 1 2 3 4
const fruits = ['Mango', 'Orange', 'Banana', 'Grapes', 'Pineapple'];

console.log('This is an Array:', fruits);

// Convert this Array to a String by .tostring(); method

// Create a String variable

const string = fruits.toString();

console.log('This is a string:', string); // default seperator of string is comma (,)

===============================================================================================

TERMINAL:






Comments