Sorry for the stupid question.
So I got this code here:  
function stat(x) {
    player.ATK = 0; player.DEF = 0; player.DEX = 0; player.crit = 0; player.HP = 0;
    player.weaponATK = weapon.x.atk;
    player.weaponDEF= weapon.x.def;
    player.weaponDEX = weapon.x.dex;
    player.weaponHP = weapon.x.hp;
    player.weaponCrit = weapon.x.crit;
    player.ATK = player.baseATK + player.weaponATK;
    player.DEF = player.baseDEF + player.weaponDEF;
    player.DEX = player.baseDEX + player.weaponDEX;
    player.HP = player.baseHP + player.weaponHP;
    player.crit = player.baseCrit + player.weaponCrit;
}
And here's the whole var i use:
var player = {
  HP: 0,
  baseHP: 100,
  weaponHP: 0,
  ATK: 0,
  baseATK: 0,
  weaponATK: 0,
  DEF: 0,
  baseDEF: 0,
  weaponDEF: 0,
  DEX: 0,
  baseDEX: 0,
  weaponDEX: 0,
  crit: 0,
  baseCrit: 5,
  weaponCrit: 0,
  level: 1,
  currentEXP: 0,
  expLeft: 10
};
var weapon = {
  hatchet: {
    atk: 2,
    def: -1,
    dex: 0,
    hp: 0,
    crit: 0
  },
  woodenSword: {
    atk: 5,
    dex: 0,
    def: 0,
    hp: 0,
    crit: 0,
  },
  ironSword: {
    atk: 10,
    crit: 5,
    dex: 0,
    def: 0,
    hp: 0
  },
  blade: {
    atk: 25,
    crit: 20,
    dex: 10,
    hp: 0,
    crit: 0,
  },
  mace: {
    atk: 30,
    def: 5,
    dex: -1,
    hp: 0,
    crit: 0,
  },
  battleAxe: {
    atk: 50,
    def: 5,
    dex: 0,
    hp: 0,
    crit: 0,
  },
  broadSword: {
    atk: 100,
    def: 20,
    dex: 0,
    crit: 0,
    hp: 0
  },
  woodenShield: {
    atk: 0,
    def: 10,
    dex: 0,
    hp: 0,
    crit: 0,
  },
  spikeShield: {
    def: 15,
    atk: 5,
    dex: 0,
    crit: 0,
    hp: 0,
  },
  bomb: {
    atk: 0,
    def: 0,
    crit: 0,
    hp: 0,
    dex: -5
  }
};
And if I run stat(hatchet), it suppose to excute the function with x replace with hatchet. But instead, I got a error: "x is not defined". Can someone help me?
Thanks for the help.
 
     
     
     
    