Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 344 Bytes

assignment-operators.md

File metadata and controls

23 lines (15 loc) · 344 Bytes

Assignment operators

let year = 1978

year += 10 // add 10 to 1978

year -= 8 // subtract 8 from 1988 = 1980

year /= 2 // divide 1980 by 2 = 990

year *= 4 // multiply 990 by 4 = 3960

let value = 2

// shift 1 bit to right
// same as 2 * 2 * 2
value <<= 2  

// shift 1 bit to left: dividing
// same as 8 / 2
value >>= 1