Change location for data files

This commit is contained in:
Kamran Ahmed committed 2023-02-21 12:25:58 +00:00
1 parent b741a0e1ee
commit b6a0255f12
2772 files changed
+30 -30

No files matched your search

@@ -0,0 +1,18 @@
# Defining and Calling Functions
**Defining:**
- JavaScript function *declarations* are made by using the `function` keyword.
- Functions can also be defined by saving function *expressions* to a variable. "Arrow" functions are commonly used in this way.
**Calling:**
- When a function is defined, it is not yet executed.
- To call and invoke a function's code, use the function's name followed by parentheses: `functionName()`.
Visit the following resources to learn more:
- [Defining Functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions#defining_functions)
- [Calling Functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions#calling_functions)
- [Function Definitions](https://www.w3schools.com/js/js_function_definition.asp)
@@ -0,0 +1,7 @@
# Default Parameters
Default function parameters allow named parameters to be initialized with default values if no value or `undefined` is passed.
Visit the following resources to learn more:
- [Default Parameters - MDN Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
@@ -0,0 +1,7 @@
# Rest Parameters
The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent [variadic functions](https://en.wikipedia.org/wiki/Variadic_function) in JavaScript.
Visit the following resources to learn more:
- [Rest Parameters - MDN Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters)
@@ -0,0 +1,7 @@
# Function Parameters
The parameter is the name given to the variable declared inside the definition of a function. There are two special kinds of syntax: default and rest parameters.
Visit the following resources to learn more:
- [Function Parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions#function_parameters)
@@ -0,0 +1,8 @@
# Arrow Functions
Arrow Function is a new way of creating functions with the '=>' operator with a shorter syntax.
Visit the following resources to learn more:
- [MDN - Arrow Function Expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions)
- [JavaScript Arrow Function](https://www.w3schools.com/js/js_arrow_function.asp)
@@ -0,0 +1,8 @@
# IIFE
Immediately-Invoked Function Expression is a function that is executed immediately after it is created.
Visit the following resources to learn more:
- [IIFE — MDN Docs](https://developer.mozilla.org/en-US/docs/Glossary/IIFE)
- [JavaScript in Plain English - IIFE](https://javascript.plainenglish.io/https-medium-com-javascript-in-plain-english-stop-feeling-iffy-about-using-an-iife-7b0292aba174)
@@ -0,0 +1,7 @@
# Arguments object
The arguments object is an Array-like object accessible inside functions that contains the values of the arguments passed to that function, available within all non-arrow functions. You can refer to a function's arguments inside that function by using its arguments object. It has entries for each argument the function was called with, with the first entry's index at 0. But, in modern code, rest parameters should be preferred.
Visit the following resources to learn more:
- [The arguments object - MDN Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments)
@@ -0,0 +1,9 @@
# Recursion
One of the most powerful and elegant concept of functions, recursion is when a function invokes itself. Such a function is called a **_recursive function_**. As recursion happens, the underlying code of the recursive function gets executed again and again until a terminating condition, called the _base case_, gets fulfilled. As you dive into the world of algorithms, you'll come across recursion in many many instances.
Visit the following resources to learn more:
- [Recursion and Stack](https://javascript.info/recursion)
- [JavaScript Function Recursions - CodeGuage](https://www.codeguage.com/courses/js/functions-recursions)
- [Recursion - MDN](https://developer.mozilla.org/en-US/docs/Glossary/Recursion)
@@ -0,0 +1,9 @@
# Lexical scoping
Before one can make an intuition of closures in JavaScript, it's important to first get the hang of the term '**_lexical environment_**'. In simple words, the lexical environment for a function `f` simply refers to the environment enclosing that function's definition in the source code.
Visit the following resources to learn more:
- [What is a lexical environment? - JavaScript - CodeGuage](https://www.codeguage.com/courses/js/functions-closures#What_is_a_lexical_environment)
- [Lexical scoping - JavaScript - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures#lexical_scoping)
- [Lexical Scope in JavaScript – What Exactly Is Scope in JS?](https://www.freecodecamp.org/news/javascript-lexical-scope-tutorial/)
@@ -0,0 +1,7 @@
# Closures
Function closures are one of the most powerful, yet most misunderstood, concepts of JavaScript that are actually really simple to understand. A closure refers to a function along with its lexical environment. It is essentially what allows us to return a function `A`, from another function `B`, that remembers the local variables defined in `B`, even after `B` exits. The idea of closures is employed in nearly every other JavaScript program, hence, it's paramount for a JavaScript developer to know it really well.
Visit the following resources to learn more:
- [JavaScript Closures - The Simplest Explanation](https://www.codeguage.com/courses/js/functions-closures)
@@ -0,0 +1,18 @@
# Scope and function stack
## Scope
A space or environment in which a particular variable or function can be accessed or used. Accessibility of this variable or function depends on where it is defined.
JavaScript has the following kinds of scopes:
- **Global scope**: The default scope for all code running in script mode.
- **Module scope**: The scope for code running in module mode.
- **Function scope**: The scope created with a function.
- **Block scope**: The scope created with a pair of curly braces (a block).
## Function Stack (Call stack)
The function stack is how the interpreter keeps track of its place in a script that calls multiple functions, like which function is currently executing and which functions within that function are being called.
Visit the following resources to learn more:
- [Function stack (call stack) - MDN](https://developer.mozilla.org/en-US/docs/Glossary/Call_stack)
- [Kinds of Scope - MDN](https://developer.mozilla.org/en-US/docs/Glossary/Scope)
@@ -0,0 +1,11 @@
# Built in functions
- A JavaScript **method** is a property containing a **function definition** . In other words, when the data stored on an object is a function we call that a method.
- To differentiate between properties and methods, we can think of it this way: **A property is what an object has, while a method is what an object does.**
- Since JavaScript methods are actions that can be performed on objects, we first need to have objects to start with. There are several objects built into JavaScript which we can use.
Visit the following resources to learn more:
- [JavaScript Built-in Functions](https://www.tutorialspoint.com/javascript/javascript_builtin_functions.htm)
- [Built-in Methods in Javascript](https://dev.to/elpepebenitez/built-in-methods-in-javascript-4bll)
- [Built-in Functions:](https://www.tutorialride.com/javascript/javascript-built-in-functions.htm)
@@ -0,0 +1,9 @@
# Functions
Functions exist so we can reuse code. They are blocks of code that execute whenever they are invoked. Each function is typically written to perform a particular task, like an addition function used to find the sum of two or more numbers. When numbers need to be added anywhere within your code, the addition function can be invoked as many times as necessary.
Visit the following resources to learn more:
- [Functions - MDN Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions)
- [JavaScript Functions - Programming with Mosh](https://youtu.be/N8ap4k_1QEQ)
- [JavaScript Functions in Detail - CodeGuage](https://www.codeguage.com/courses/js/functions-basics)