KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In the accepted answer on my earlier question ( What is the fastest way to generate a random integer in javascript? ), I was wondering how a number loses its decimals via the symbol | . For example: var x = 5.12042; x = x|0; How does that floor the number to 5 ? Some more examples: console.log( 104.249834 | 0 ); //104 console.log( 9.999999 | 0 ); // 9
Tags (comma-separated)
Save Edits
Cancel