mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Adding modulo division to JavaScript article
This commit is contained in:
parent
324c707c08
commit
53366ebdbe
@ -54,6 +54,11 @@ doStuff()
|
|||||||
// Including uneven division.
|
// Including uneven division.
|
||||||
5 / 2; // = 2.5
|
5 / 2; // = 2.5
|
||||||
|
|
||||||
|
// And modulo division.
|
||||||
|
10 % 2; // = 0
|
||||||
|
30 % 4; // = 2
|
||||||
|
18.5 % 7; // = 4.5
|
||||||
|
|
||||||
// Bitwise operations also work; when you perform a bitwise operation your float
|
// Bitwise operations also work; when you perform a bitwise operation your float
|
||||||
// is converted to a signed int *up to* 32 bits.
|
// is converted to a signed int *up to* 32 bits.
|
||||||
1 << 2; // = 4
|
1 << 2; // = 4
|
||||||
|
Loading…
Reference in New Issue
Block a user