In jquery source:
eq: function( i ) {
i = +i;
return i === -1 ?
this.slice( i ) :
this.slice( i, i + 1 );
},
Is it used for make sure parse i to int?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, it is to make sure that
iis a number (eitherfloatorint). Given what the function is doing, it was better to convertito an non-decimal value though, I’m not sure howslicehandles decimals.More information:
MDN - Arithmetic Operators