Javaskript : Simple substraction returns NaN : I have a problem,
my collision detection function sometimes sets entity position to NaN.
When I open console (on chrome) position of entity and collision are valid numbers but substracting them from each other sometimes returns NaN.

    updateCollision = function(entity,rect) {
	var a = entity.x - rect.x; // a = NaN , entity.x = 3117.2646499953607 , rect.x = 3296.976967651385
	var b = entity.y - rect.y; // b = NaN , entity.y = 3024.105915848102 , rect.y = 3144.4270586199345
	
	if( isNaN(a) ) // isNaN(a) = true
	{
		console.log("not again >:("); // but console doesn't log
	}
	
	//the code continues but its not important

[(screenshot of console)][1]


  [1]: https://i.stack.imgur.com/sgjco.png


So I am realy confused, and don't know what to do with this issue.