From 197064d66a60967bd2455e8e1406161e0f9ddc3a Mon Sep 17 00:00:00 2001 From: Patrick Brosset Date: Mon, 23 Oct 2023 11:55:17 +0200 Subject: [PATCH] Fixed code snippet to create a large string --- .../memory-problems/heap-snapshots.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/microsoft-edge/devtools-guide-chromium/memory-problems/heap-snapshots.md b/microsoft-edge/devtools-guide-chromium/memory-problems/heap-snapshots.md index e1eb398262..a72fdee940 100644 --- a/microsoft-edge/devtools-guide-chromium/memory-problems/heap-snapshots.md +++ b/microsoft-edge/devtools-guide-chromium/memory-problems/heap-snapshots.md @@ -189,8 +189,8 @@ Name the functions, so that you can easily distinguish between closures in the s ```javascript function createLargeClosure() { - var largeStr = new Array(1000000).join('x'); - var lC = function() { // this is NOT a named function + var largeStr = 'x'.repeat(1000000).toLowerCase(); + var lC = function() { // This is not a named function return largeStr; }; return lC; @@ -201,8 +201,8 @@ The following code uses named functions, to easily distinguish between closures ```javascript function createLargeClosure() { - var largeStr = new Array(1000000).join('x'); - var lC = function lC() { // this IS a named function + var largeStr = 'x'.repeat(1000000).toLowerCase(); + var lC = function lC() { // This is a named function return largeStr; }; return lC;