From 3569e645a5dde7593c9538b346cef13df07593a9 Mon Sep 17 00:00:00 2001 From: omar2205 Date: Fri, 1 Jul 2022 01:40:05 +0200 Subject: [PATCH] fix: update JOKES example to use the array's length (#337) --- init.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.ts b/init.ts index 9fccd891..653a5bec 100644 --- a/init.ts +++ b/init.ts @@ -211,7 +211,7 @@ const JOKES = [ ]; export const handler = (_req: Request, _ctx: HandlerContext): Response => { - const randomIndex = Math.floor(Math.random() * 10); + const randomIndex = Math.floor(Math.random() * JOKES.length); const body = JOKES[randomIndex]; return new Response(body); };