I want to create a function which takes an input and returns an incremented Id each time it is called.
Something like:
function createId(input){
let initialValue = 1
let newId = `ID-${initialValue++}`
return newId
So here in this function I will pass input as 'xyz', 'abc', etc based on which it should return an Id.
Like: If I am passing 'xyz' then it should return newId as Id-1 then Id-2 then Id-3 each time the function is called with xyz, Similarly, each time function is called with 'abc' it should return newId as Id-1, Id-2, Id-3.
I am Unable to create the ID based on inputs given. Thank you