0
Is it ok to make a function with both straight js and jquery?
I made a function with both js and jquery, and it works. Im wondering if it is bad ju ju to do such a thing? Is this a coding abomination? It does work. function myDmgFunc (){ if(hp >= 1){ var charDmg = parseInt(document.getElementById("input1").value); var dmg = Math.floor((Math.random()*charDmg)+1); hp = hp - dmg; dmg = Math.floor((Math.random()*charDmg)+1); document.getElementById("mnstrHp").innerHTML = hp; }else{ $("#mnstrHp").html("Monster is dead"); } }
1 Resposta
+ 1
It will work. and it's totally fine. But obviously, if you will use jQuery, there's no point in using plain js unless it's necessary.