In JavasScript, an array is a very common data structure. We use it almost daily. In this post, we share some awesome JavaScript One-Liners code for array objects to make your frontend development life easier.
array.join(",")
Object.values(object)
Array.from({ length: n }, (_, i) => i)
Array.isArray(variable)
array.length === 0
Math.max(...array)
Math.min(...array)
[...new Set(array)]
array.filter(x => x === element).length
array.reduce((a, b) => a + b, 0));