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"); } }

5th Jan 2018, 5:28 AM
Dennis Hardy
Dennis Hardy - avatar
1 Respuesta
+ 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.
5th Jan 2018, 6:07 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar