contar javascript

const collect = require('collect.js');

const collection = collect([1, 2, 3, 4]);
const x = collection.count();
  
console.log(`Total number of elements are : ${x}`);
// Output: Total number of elements are : 4
Undefined