<prompt> Unda chaguo la kukokotoa la JavaScript ambalo huchukua mkusanyiko wa nambari kamili na kurejesha kitu kilicho na takwimu zifuatazo: thamani ya chini, thamani ya juu zaidi, wastani na wastani. Andika vipimo vya kitengo kwa chaguo hili la kukokotoa kwa kutumia mfumo wa upimaji wa Jest.PLINFORMAT  <response>: kazi hesabuStatsarr ikiwa !Array.isArrayarr arr.length 0 tupa Hitilafu mpyaIngizo lazima iwe safu isiyo tupu; const sortedArr ...arr.pangaa, b a - b; const sum arr.reduceacc, val acc val, 0; const min sortedArr0; const max sortedArrarr.length - 1; const avg jumla arr.length; const median arr.length 2 0 ? sortedArrarr.length 2 sortedArrarr.length 2 - 1 2 : sortedArrMath.floorarr.length 2; rudisha min, max, avg, median ;const test, expect requirejestglobals;const countStats need.calculateStats;testhuhesabu takwimu sahihi kwa safu ya urefu usio wa kawaida, const input 3, 5, 1, 7, 9; const expectedOutput dakika: 1, Upeo: 9, wastani: 5, wastani: 5, ; expectcalculateStatsinput.toEqualexpectedOutput;;testhuhesabu takwimu sahihi kwa safu ya urefu sawa, const pembejeo 10, 20, 30, 40; const expectedOutput dakika: 10, upeo: 40, wastani: 25, wastani: 25, ; expectcalculateStatsinput.toEqualexpectedOutput;;testhutupa makosa wakati ingizo sio safu, const input sio safu; expect countStatsinput.toThrowIngizo lazima iwe safu isiyo tupu;;testhutupa makosa wakati ingizo ni safu tupu, const input ; expect countStatsinput.toThrowIngizo lazima iwe safu isiyo tupu;; 