Google News
logo
Collect.js - Interview Questions
What is flip() method in Collect.js?
flip() : The flip() method swaps the collection's keys with their corresponding values:
const collection = collect({
  name: 'Free Time Learn',
  number: 31,
});

const flipped = collection.flip();

flipped.all();

// {
//   'Free Time Learn': 'name',
//   '31': 'number',
// }
Advertisement