JSFiddle - React, Tailwind, and code Playground
JavaScript
json =
{ "001": "Something"
, "002": { "message": "And more stuff" }
, "003": 42
, "Suddenly": "Okay"
}
const keys = Object.keys(json).map(el => parseInt(el));
console.log(keys);
const nums = [];
i = 1;
while (i < 999) {
if (!keys.includes(i)) {
nums.push(`${i}`.padStart(3, '0'));
}
i++;
}
orderID = nums[0]
console.log(orderID);