From 24d57aa4855b178254f36c7378738d1e59997e29 Mon Sep 17 00:00:00 2001 From: Jai Sinha Date: Sun, 2 Oct 2022 14:25:14 +0300 Subject: [PATCH 1/3] Added different types of text-editors that a developer can use in linux at the bottom of the cheatsheet --- linux.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/linux.md b/linux.md index 5835dac..502c838 100644 --- a/linux.md +++ b/linux.md @@ -42,3 +42,10 @@ tar -zcvf foo.txt.tar.gz foo.txt tar -xvf foo.txt.tar.gz ``` +## Text Editor Options for Programmers + +```c +Sublime Text Atom GNU Emacs +Vim Gedit Notepadqq +Nano VsCode Brackets +``` From 7a745fd3ed42b58f2260940c968a8c67207b3798 Mon Sep 17 00:00:00 2001 From: Jai Sinha Date: Mon, 3 Oct 2022 12:46:22 +0300 Subject: [PATCH 2/3] The fundamental defination and the example of closures has been added at the bottom of the cheatsheet --- javascript.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/javascript.md b/javascript.md index 463ff27..b91d5c4 100644 --- a/javascript.md +++ b/javascript.md @@ -349,3 +349,22 @@ throw "Error message"; // throw error text to user |g| Performs a global match and finds all| |i| Performs case-insensitive matching| |m| Performs multiline matching| + +## Closures + +A closure is the combination of a function bundled together (enclosed) with references + to its surrounding state (the lexical environment). In other words, a closure gives you +access to an outer function's scope from an inner function. In JavaScript, closures are +created every time a function is created, at function creation time. + +### Example +```c +function makeFunc() { + const name = 'Mozilla'; + function displayName() { + console.log(name); + } + return displayName; +} +const myFunc = makeFunc(); +myFunc();``` From f1dae91a6e219cedb2afc51226d64cd88b4f3363 Mon Sep 17 00:00:00 2001 From: Jai Sinha Date: Mon, 3 Oct 2022 12:50:20 +0300 Subject: [PATCH 3/3] The basic defination and the example of closures has been added at the bottom of the cheatsheet --- javascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript.md b/javascript.md index b91d5c4..c653bc1 100644 --- a/javascript.md +++ b/javascript.md @@ -367,4 +367,4 @@ function makeFunc() { return displayName; } const myFunc = makeFunc(); -myFunc();``` +myFunc();