Description of the problem:
" TypeError: Cannot use ‘in’ operator to search for ‘XXXXX’ in undefined"
I used the auto-translate function and am having a couple of issues.
My code is supposed to check if an object “selectedPrimeprac” can be found in an array “primeListprac”. If it is found in the list it is deleted.
The python code:
primeListprac = [“SOUL”, “PILE”, “WRECK”, “PLEAD”, “FLASH”, “TRIBE”, “EXTENT”, “COLONY”, “FUNERAL”, “MONARCH”]
if(selectedPrimeprac in primeListprac):
primeListprac.remove(selectedPrimeprac)
The JS code:
primeListprac = [“SPIRIT”, “STACK”, “CRASH”, “BEGGAR”, “BRIGHT”, “CHEIFTAN”, “DEGREE”, “SETTLE”, “ARCADE”, “MIGHTY”];
if (_pj.in_es6(selectedPrimeprac, primeListprac)) {
primeListprac.remove(selectedPrimeprac);
}