From a8ff59e3baa97fd8596ecd3f1df2c3db52b8af20 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 21 Nov 2017 12:30:31 +0200 Subject: [PATCH] Typo - mistake in canceling interval function --- 1-js/06-advanced-functions/08-settimeout-setinterval/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/06-advanced-functions/08-settimeout-setinterval/article.md b/1-js/06-advanced-functions/08-settimeout-setinterval/article.md index cc347aae..e52feac7 100644 --- a/1-js/06-advanced-functions/08-settimeout-setinterval/article.md +++ b/1-js/06-advanced-functions/08-settimeout-setinterval/article.md @@ -233,7 +233,7 @@ When a function is passed in `setInterval/setTimeout`, an internal reference is setTimeout(function() {...}, 100); ``` -For `setInterval` the function stays in memory until `cancelInterval` is called. +For `setInterval` the function stays in memory until `clearInterval` is called. There's a side-effect. A function references the outer lexical environment, so, while it lives, outer variables live too. They may take much more memory than the function itself. So when we don't need the scheduled function anymore, it's better to cancel it, even if it's very small. ````