function IsIntersect () { const enemyLeft = parseInt($('#enemies').css("left")); const playerLeft = parseInt($('#player').css("left")); const playerWidth = $("#player").width(); const enemyWidth = $('#enemies').width(); if ((playerLeft + playerWidth >= (enemyLeft * -1) && playerLeft < (enemyLeft * -1) + enemyWidth)) { console.log(true); return true; } else { console.log(false); return false; } }
The fact is that the function does not return anything, it’s not about if’s work or something else, for some reason it doesn't give anything to the exit, what could be the matter?