I often find myself doing these sort of ternary constructs which seem to lack elegance:
pixels = ( pixels > (canvas.top + canvas.left) ) ? canvas.top + canvas.left : pixels;
Is there a more succinct way stating pixels = whatever is smaller
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.
use Math.min:
Here is a reference of what you can do with Math object.