{"issue":{"created_at":"2011-11-23T15:19:39Z","state":"closed","updated_at":"2011-11-29T13:11:18Z","user":{"gravatar_id":"2e1599d22dce3e1661b6e63e8514b38e","id":155633,"url":"https://api.github.com/users/millermedeiros","avatar_url":"https://secure.gravatar.com/avatar/2e1599d22dce3e1661b6e63e8514b38e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"millermedeiros"},"comments":22,"body":"I've seen a lot of people using `length >>> 0` on their code (including the MDN shims) but never really understood why, just want to clarify the reasoning behing it, I know what `>>>` does just don't understand why it's being used in this case..\r\n\r\nif `length` is negative it will return `Math.pow(2, 32) + length` (that's what zero-fill right shift does with negative numbers..) if length is `NaN` it will return `0` and if value is positive it will do a `Math.floor()` (because bitwise operations works with integers..)\r\n\r\nwhy not simply do `~~length`?? it will take care of `NaN` and `Math.floor()` and negative lengths will be ignored since loops won't execute..\r\n\r\n```js\r\n~~ 0.35;  // 0\r\n~~ 9.75;  // 9\r\n~~ -9.75; // -9\r\n~~ '';    // 0\r\n~~ 'foo'; // 0\r\n~~ NaN;   // 0\r\n```\r\n\r\nin the current setup if `self.length` is negative (probably won't happen :P) it will cause an \"infinite\" loop.","assignee":null,"id":2330647,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"labels":[],"number":78,"title":"question: why `self.length >>> 0`?","closed_at":"2011-11-24T19:18:57Z","html_url":"https://github.com/kriskowal/es5-shim/issues/78","url":"https://api.github.com/repos/kriskowal/es5-shim/issues/78","milestone":null},"action":"created","comment":{"created_at":"2011-11-29T13:11:18Z","updated_at":"2011-11-29T13:11:18Z","user":{"gravatar_id":"299a3d891ff1920b69c364d061007043","id":4303,"url":"https://api.github.com/users/jdalton","avatar_url":"https://secure.gravatar.com/avatar/299a3d891ff1920b69c364d061007043?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jdalton"},"body":"btw @bryanforbes, this thread forked to  [millermedeiros/amd-utils/issues/17](https://github.com/millermedeiros/amd-utils/issues/17) too.","id":2929558,"url":"https://api.github.com/repos/kriskowal/es5-shim/issues/comments/2929558"}}