I have some working code and eventually end up with multiple returned values. Something like this:
console.log(variableName)
-- var1, var2, var1, var3 etc
How do I write a function to get all those variables that are logged from the variable into an object like this? (Fore every repeat the keys must be incremented/counted).
var obj {
var1 : 2
var2 : 1
var3 : 1
var4 : 0
}
I guess your
variableNamevar is an array like such :In which case you could do this :