Skip to content

randomEntry

Subhajit Sahu edited this page Dec 8, 2022 · 1 revision

Pick an arbitrary entry.

Similar: entries, hasEntry, randomEntry.
Similar: keys, values, entries.


function randomEntry(x, fr)
// x:  an object
// fr: random number generator ([0, 1))
const object = require('extra-object');

var x = {a: 1, b: 2, c: 3};
object.randomEntry(x);
// → [ 'c', 3 ]

object.randomEntry(x);
// → [ 'b', 2 ]


References

Clone this wiki locally