Monday, December 5, 2022

JS can surprise me still to this day (Array toString() is join())

I didn't know but these expressions yield the same result in JavaScript:

const a = [1,2,3];

console.log(a.join(','));

console.log(`${a}`);

I think it makes sense, but still, the language still today can surprise me.

No comments:

Post a Comment