diff --git a/zerver/openapi/javascript_examples.js b/zerver/openapi/javascript_examples.js index 182499a609..5db423b9e0 100644 --- a/zerver/openapi/javascript_examples.js +++ b/zerver/openapi/javascript_examples.js @@ -301,9 +301,9 @@ add_example( add_example("update_message_flags", "/messages/flags:post", 200, async (client, console) => { // Send 3 messages to run this example on - const message_ids = [...Array.from({length: 3})]; - for (let i = 0; i < message_ids.length; i = i + 1) { - message_ids[i] = await send_test_message(client); + const message_ids = []; + for (let i = 0; i < 3; i += 1) { + message_ids.push(await send_test_message(client)); } // {code_example|start}