GitHub 6521★

Generate an unique and increment id

JavaScript version

const uid = (() => ((id = 0), () => id++))();

Examples

uid(); // 0
uid(); // 1
uid(); // 2
uid(); // 3
Follow me on and to get more useful contents.