.slice() is not a function although called on string
<p>I'm trying to figure out some collision, but the compiler keeps showing the error that .slice() is not a function. Here is the code:</p>

<pre><code>var topPos1 = $('#player').css("top");
var rightPos1 = $('#player').css("right");
var topPos2 = $('#player').css("top");
var rightPos2 = $('#player').css("right");
var pos = topPos1.indexOf('px');
topPos1 = parseInt(topPos1.slice(0,pos));
</code></pre>

<p>My jQuery is loaded.</p>