Filter Difficulties

I'm currently attempting to try and filter an actor's available weapons by those that match a variable wtypeId, but all I've been getting so far are errors, and the syntax looks correct. The relevant code is below:

Game_Actor.prototype.activateBestType = function(wtypeId1, wtypeid2){
var weapons = this.weapons().filter(function(wpn) { return wpn.wtypeId === wtypeId1 || wpn.wtypeId === wtypeId2; });
...
};

(Note that the weapons() function already filters out null values, so it'd be redundant to include it above.)
You have a typo for wtypeId2 in your function's arguments. You're using a lowercase i rather than the uppercase I you're comparing too. Try this
PHP:
Game_Actor.prototype.activateBestType = function (wtypeId1, wtypeId2) {
  var weapons = this.weapons().filter(function (wpn) {
    return wpn.wtypeId === wtypeId1 || wpn.wtypeId === wtypeId2;
  });
};
Thanks. Also caught an error in the plugin command I was using to test that. Now it runs without errors (although it's hardly complete yet).
And now that function works perfectly. Well, so long as it's only called when you aren't switching your dual wield weapons around (which I recently ensured).

This means the main feature of my plugin is almost complete. 😀

Original thread: https://forums.rpgmakerweb.com/threads/filter-difficulties.81219/