79107128

Date: 2024-10-20 13:21:16
Score: 2
Natty:
Report link

To get the middle of an array you could just try accessing array[size/2]. If size is not even and you want to be sure to get the 'lowest' half or the 'highest' half. You could use the function ceil (The ceil() method rounds a number UP to the nearest integer) and floor (The floor() method rounds a number DOWN to the nearest integer) to access array[Math.floor(size/2)] or array[Math.ceil(size/2)]

Reasons:
  • No code block (0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: Halaume