Discern and perform an operation on a list I have some code that's meant to discern certain words in a list and then based on which word is in the list, do a mathematical operation on the numbers also found in the list. Here's my code: 

  for (op in operations) {
    if (arrayses.letteros.indexOf(op) !== -1) {
      found = true;
      break;
    }
  }
  if (found) {
    var result = arrayses.numeros[0];
    while (i &lt; arrayses.numeros.length) {
      if (i === 0) {
        result = arrayses.numeros[0];
      } else {
        result = operations[op](result, arrayses.numeros[i]);
      }
      i += 1;
    } 


The part of the code I'm having trouble with is the very first line up there. My program has to pass JSLint based on the assumption I'm using a browser and tolerating multiple variables and whitespace mess. JSLint says the for in my for...in statement up there is unexpected; are there any alternatives to using that statement? It's used to look for the operations listed above my function in a global variable.

Here's where operations is defined, it's a global variable:

var operations = {      
  add: function(a, b) {
  "use strict";       
    return Number(a) + Number(b);
  },
  subtract: function(a, b) {
  "use strict";       
    return a - b;
  },
  multiply: function(a, b) {
  "use strict";       
    return a * b;
  },
  divide: function(a, b) {
  "use strict";       
    return a / b;

  }
};
You could use Object.keys and Array#some to determine if any key in an object fits your criteria:

found = Object.keys(operations).some((op) =&gt; arrayses.letteros.indexOf(op) !== -1);


In general, you can use Object.keys and array iteration methods (forEach, map, reduce, some, every, etc.) to replace for..in loops.