xxxxxxxxxx
const str = 'javascript';
const arr = Array.from(str);
// output:
// ['j', 'a', 'v', 'a', 's', 'c', 'r', 'i', 'p', 't']
xxxxxxxxxx
var cars = ["Volvo", "BMW", "Audi", "Chevrolet"];
console.log(cars.toString());
//Output: Volvo,BMW,Audi,Chevrolet
xxxxxxxxxx
const cities = ['London', 'Paris', 'Tokyo'];
const joinedCities = cities.join();
console.log(joinedCities); // London,Paris,Tokyo
xxxxxxxxxx
const classNames = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
function getClassName() {
return classNames.join(" ").toString()
}
console.log(getClassName()) // a b c d e f g h i j
xxxxxxxxxx
const str = 'javascript';
const arr = [str];
// output:
// ['j', 'a', 'v', 'a', 's', 'c', 'r', 'i', 'p', 't']
xxxxxxxxxx
const str = "javascript";
const arr = str.split('');
console.log(arr);
// output:
// ['j', 'a', 'v', 'a', 's', 'c', 'r', 'i', 'p', 't']
xxxxxxxxxx
const str = 'javascript';
const arr = Object.assign([], str);
// output:
// ['j', 'a', 'v', 'a', 's', 'c', 'r', 'i', 'p', 't']
xxxxxxxxxx
const str = 'javascript';
const arr = Array.prototype.map.call(str, x => x);
// output:
// ['j', 'a', 'v', 'a', 's', 'c', 'r', 'i', 'p', 't']