-
Notifications
You must be signed in to change notification settings - Fork 3
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 ]