R
Reactiflux

help-js

Axel (Rinkusu) – 15-49 Oct 31

LLaRynk10/31/2022
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)
}
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)
}
UUUnknown User10/31/2022
Message Not Public
Sign In & Join Server To View
LLaRynk10/31/2022
it is, so what can I do please ?
UUUnknown User11/1/2022
2 Messages Not Public
Sign In & Join Server To View

Looking for more? Join the community!