Omit largest and smallest numbers from function


/ Published in: JavaScript
Save to your folder(s)

I have an array of numbers between 0 and 1, and I want to remove 0 and 1 from a for-each loop. Instead of <code>if (x != 0 || x != 1) {}</code>, this seems nicer:


Copy this code and paste it in your HTML
  1. if (x%1 != 0) {
  2. // Do something
  3. }

URL: clevermod

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.