I am a bit of a noob when it comes to javascript, but I cannot seem to find the reason why this is returning "undefined"
mineOre(userData.pickaxe, playerData.questid);
var newOre = new function () {
var chance = Math.floor(Math.random() * 100);
//console.log(chance);
/*
20% Iron
30% Coal
5% Diamond
3% Emerald
1% Brandons Hair
41% Stone
*/
if (chance < 20) {
return "Iron";
} else if (chance < 50) {
return "Coal";
} else if (chance < 55) {
return "Diamond";
} else if (chance < 58) {
return "Emerald";
} else if (chance < 59) {
return "BrandonsHair";
} else return "Stone";
}
function mineOre(pickaxe, questid) {
console.log(newOre);
}