LaRynkL
Reactiflux4y ago
3 replies
LaRynk

Axel (Rinkusu) – 15-49 Oct 31

Hi, I get minus zeros when doing modulos operations with values from an object. Any idea please ?
      const LADY_ORIENTATION = [
        {value: -9, orientation: 'topLeft'},
        {value: -7, orientation: 'topRight'},
        {value: 9, orientation: 'bottomRight'},
        {value: 7, orientation: 'bottomLeft'}
      ]

      let orientation

      LADY_ORIENTATION.forEach((elem, i) => {
        console.log('calc:', SELECTED_POS % elem?.value)
        if (SELECTED_POS % elem?.value === 0) {
          orientation = LADY_ORIENTATION[i]?.orientation
        }
      })
      console.log('orientation:', orientation)
    }
unknown.png
Was this page helpful?