Skip to content

Commit

Permalink
Merge pull request #2889 from MicrosoftDocs/user/pabrosse/closure
Browse files Browse the repository at this point in the history
Fixed code snippet to actually create a large strings in the heap snapshot article
  • Loading branch information
captainbrosset authored Oct 24, 2023
2 parents e373e80 + 197064d commit 94e400b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 94e400b

Please sign in to comment.