I have the following code:
scope.cm = 1;
scope.mm = 2;
scope.km = 3;
tipoDeMedida[scope.cm || scope.mm || scope.km] = function(arrayQualquer){
//executo meu bloco de código X.
}
tipoDeMedida[scope.km](arrayQualquer)
I'm getting the following error output:
tipoDeMedida[scope.km] is not a function
From what I understand, in the function of the first block of code, you are not accepting the OR operator for each type of data I am trying to pass. I would like to know if there is any elegant way to solve this problem without having to do a function for each data type (I do not want to execute block X three times).