From 24da8324c4af747e4cdf450111f7f65572a6619f Mon Sep 17 00:00:00 2001 From: ajay-dhangar <99037494+Ajay-Dhangar@users.noreply.github.com> Date: Sun, 13 Oct 2024 12:33:49 +0000 Subject: [PATCH 1/4] Updated contributors list --- README.md | 112 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 63 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 3e4296c2d..7d0c04834 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,13 @@ We are grateful to all the contributors who have helped improve this project. Yo Haseeb Zaki + + + Riyachauhan11 +
+ Riya Chauhan +
+ shimmer12 @@ -199,6 +206,8 @@ We are grateful to all the contributors who have helped improve this project. Yo Kajal Ahirwar + + govindumeesala @@ -206,8 +215,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Meesala Govindu - - kRajoria121 @@ -222,6 +229,13 @@ We are grateful to all the contributors who have helped improve this project. Yo nishant4500 + + + Hamza1821 +
+ Hamza Mubin +
+ sriraghavi22 @@ -230,10 +244,19 @@ We are grateful to all the contributors who have helped improve this project. Yo - - Hamza1821 + + samar12-rad
- Hamza Mubin + Samarth Vaidya +
+ + + + + + 4F24L +
+ Md Afzal Mir
@@ -244,14 +267,12 @@ We are grateful to all the contributors who have helped improve this project. Yo - - 4F24L + + 17arindam
- Md Afzal Mir + Arindam
- - jvkousthub @@ -273,6 +294,8 @@ We are grateful to all the contributors who have helped improve this project. Yo Soumyadeep Paul + + tanushrigoel @@ -293,15 +316,6 @@ We are grateful to all the contributors who have helped improve this project. Yo
Yash Kumar Saini
- - - - - - 17arindam -
- Arindam -
@@ -324,6 +338,8 @@ We are grateful to all the contributors who have helped improve this project. Yo Navya Sharma + + PrAyAg9 @@ -338,8 +354,13 @@ We are grateful to all the contributors who have helped improve this project. Yo Durga Karthik Yandrapu - - + + + AswaniBolisetti +
+ Aswani Bolisetti +
+ yogeswari05 @@ -361,6 +382,8 @@ We are grateful to all the contributors who have helped improve this project. Yo Mehul Prajapati + + meghanakn473 @@ -368,6 +391,13 @@ We are grateful to all the contributors who have helped improve this project. Yo K N Meghana + + + Bhumika-00 +
+ Bhumika Sharma +
+ 1-SubhamSingh @@ -382,8 +412,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Tejas Athalye - - shalini-bhandari @@ -398,6 +426,8 @@ We are grateful to all the contributors who have helped improve this project. Yo Ruksina + + CygnusST3RN @@ -412,13 +442,6 @@ We are grateful to all the contributors who have helped improve this project. Yo PRASHANT SWAROOP - - - Bhum-ika -
- Bhumika Sharma -
- nishakp3005 @@ -426,8 +449,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Nishita Panchal - - jashwanthbavandlapalli @@ -443,12 +464,14 @@ We are grateful to all the contributors who have helped improve this project. Yo - - Bhumika-00 + + Bhum-ika
Bhumika Sharma
+ + Lokesh11868 @@ -470,8 +493,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Mohith Singh - - AmanPathan @@ -493,6 +514,8 @@ We are grateful to all the contributors who have helped improve this project. Yo Kratik Mandloi + + meghanakn22 @@ -514,8 +537,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Abhinandan - - KunikaMakker @@ -537,13 +558,8 @@ We are grateful to all the contributors who have helped improve this project. Yo Sejal - - - samar12-rad -
- Samarth Vaidya -
- + + RanaJay3101 @@ -558,8 +574,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Rajat singhal - - Rahul7raj @@ -588,6 +602,8 @@ We are grateful to all the contributors who have helped improve this project. Yo Thalla Jayanth + + ImgBotApp @@ -602,8 +618,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Vivek Prakash - - IRFANSARI2 From 31aea322a1133edf5554896779cc4493c6474f10 Mon Sep 17 00:00:00 2001 From: kunikamakker Date: Sun, 13 Oct 2024 18:49:57 +0530 Subject: [PATCH 2/4] function documentation --- docs/languages/javascript/ex-8.md | 103 ++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 docs/languages/javascript/ex-8.md diff --git a/docs/languages/javascript/ex-8.md b/docs/languages/javascript/ex-8.md new file mode 100644 index 000000000..5cb1b9b23 --- /dev/null +++ b/docs/languages/javascript/ex-8.md @@ -0,0 +1,103 @@ +--- +id: functions-in-javascript +sidebar_position: 8 +title: Functions in JavaScript +sidebar_label: Functions in JS +--- + +A function in JavaScript is similar to a procedure—a set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is some obvious relationship between the input and the output. + + + +## **Functions Declaration** + +Function Declarations also known as function statement or function definition consists of function keyword, function name, parameters separated by commas and function body enclosed by curly braces ```{ /*function body*/ }``` + + +```javascript +function printName(name) { + return name; +} +``` + +In the example above, the function ```printName``` takes one parameter called ```name```. The function body consist of one statement that returns the name. + + + +## **Function Expressions** + +Function expressions are a way to define a function as part of an expression. Unlike function declarations, which define a function with a name, function expressions can be anonymous (without a name) or named. + +## 1. **Anonymous Function Expression** +An anonymous function expression is a function that doesn't have a name. It can be assigned to a variable, passed as an argument to another function, or returned from another function. + +```javascript +const greet = function() { + console.log("Hello!"); +}; + +greet(); +``` + +## 2. **Named Function Expression** +A named function expression includes a name. This can be useful for recursion or for better debugging. + +```javascript +const greet = function sayHello() { + console.log("Hello!"); +}; + +greet(); +``` + +## 3. **IIFE (Immediately Invoked Function Expression)** +An IIFE is a function that runs as soon as it is defined. It’s often used to create a local scope. + +```javascript +(function() { + console.log("This runs immediately!"); +})(); +``` + + + +## **Function Call** + +Calling a function means executing the code defined within it. There are various ways to call a function. + +```javascript +const greet = function(name) { + console.log("Hello ", name); +}; + +greet("World!"); //Output: Hello World! +``` + +The above example is calling a function with argument + + +```javascript +const obj = { + greet: function() { + console.log("Hello from an object!"); + } +}; + +obj.greet(); // Output: Hello from an object! +``` + +The above example is calling a method of an object + +```javascript +const multiply = (x, y) => x * y; + +console.log(multiply(2, 3)); // Output: 6 +``` + +The above example is of calling an arrow function + + +## More Resources: + +- [MDN Web Docs: Functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions) +- [W3Schools: JavaScript Functions](https://www.w3schools.com/js/js_functions.asp) From a0408d26a5300f34e1e0b945d5852785ec4fbb2c Mon Sep 17 00:00:00 2001 From: ajay-dhangar <99037494+Ajay-Dhangar@users.noreply.github.com> Date: Sun, 13 Oct 2024 13:20:18 +0000 Subject: [PATCH 3/4] Updated contributors list --- README.md | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 7d0c04834..92e8450ff 100644 --- a/README.md +++ b/README.md @@ -494,17 +494,17 @@ We are grateful to all the contributors who have helped improve this project. Yo - - AmanPathan + + KunikaMakker
- Ronin + Kunika Makker
- - RchtDshr + + AmanPathan
- Rachita Dashore + Ronin
@@ -537,13 +537,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Abhinandan - - - KunikaMakker -
- Kunika Makker -
- Subashree-selvaraj @@ -558,8 +551,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Sejal - - RanaJay3101 @@ -567,6 +558,8 @@ We are grateful to all the contributors who have helped improve this project. Yo Rana Jay + + rajatsinghal02 @@ -602,8 +595,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Thalla Jayanth - - ImgBotApp @@ -611,6 +602,8 @@ We are grateful to all the contributors who have helped improve this project. Yo Imgbot + + IkkiOcean From 66c76f40df0797e7375996b9cf1239605092b1b8 Mon Sep 17 00:00:00 2001 From: ajay-dhangar <99037494+Ajay-Dhangar@users.noreply.github.com> Date: Mon, 14 Oct 2024 04:50:48 +0000 Subject: [PATCH 4/4] Updated contributors list --- README.md | 224 +++++++++++++++++++++++++++--------------------------- 1 file changed, 110 insertions(+), 114 deletions(-) diff --git a/README.md b/README.md index 14969dafc..dc772ad79 100644 --- a/README.md +++ b/README.md @@ -128,10 +128,10 @@ We are grateful to all the contributors who have helped improve this project. Yo - - KapuluruBhuvaneswariVspdbct + + AbhijitMotekar99
- Bhuvaneswari Kapuluru + Abhijit Motekar
@@ -142,17 +142,17 @@ We are grateful to all the contributors who have helped improve this project. Yo - - AbhijitMotekar99 + + KapuluruBhuvaneswariVspdbct
- Abhijit Motekar + Bhuvaneswari Kapuluru
- - ananyag309 + + haseebzaki-07
- Ananya Gupta + Haseeb Zaki
@@ -164,6 +164,13 @@ We are grateful to all the contributors who have helped improve this project. Yo + + + ananyag309 +
+ Ananya Gupta +
+ PavanTeja2005 @@ -178,13 +185,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Kundan Rajoria - - - haseebzaki-07 -
- Haseeb Zaki -
- Riyachauhan11 @@ -229,13 +229,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Meesala Govindu - - - Hamza1821 -
- Hamza Mubin -
- anshika-1102 @@ -244,14 +237,12 @@ We are grateful to all the contributors who have helped improve this project. Yo - - jvkousthub + + Hamza1821
- Kousthub J V + Hamza Mubin
- - sriraghavi22 @@ -259,18 +250,13 @@ We are grateful to all the contributors who have helped improve this project. Yo sriraghavi22 + + - - IkkiOcean -
- Vivek Prakash -
- - - - priyashuu + + jvkousthub
- Priya + Kousthub J V
@@ -287,6 +273,20 @@ We are grateful to all the contributors who have helped improve this project. Yo Md Afzal Mir + + + IkkiOcean +
+ Vivek Prakash +
+ + + + priyashuu +
+ Priya +
+ yashksaini-coder @@ -296,6 +296,13 @@ We are grateful to all the contributors who have helped improve this project. Yo + + + IRFANSARI +
+ Irfan Ansari +
+ 17arindam @@ -310,13 +317,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Narendra Dhangar - - - IRFANSARI -
- Irfan Ansari -
- tanushrigoel @@ -332,47 +332,47 @@ We are grateful to all the contributors who have helped improve this project. Yo - - mehul-m-prajapati + + Saaarthak0102
- Mehul Prajapati + Sarthak
- - vedhcet-07 + + Mansi07sharma
- Vishwas M D + Mansi07sharma
- - yogeswari05 + + 770navyasharma
- Chekka Yogeswari + Navya Sharma
- - meghanakn473 + + PrAyAg9
- K N Meghana + PrAyAg9
- - AswaniBolisetti + + karthikyandrapu
- Aswani Bolisetti + Durga Karthik Yandrapu
- - karthikyandrapu + + AswaniBolisetti
- Durga Karthik Yandrapu + Aswani Bolisetti
@@ -385,54 +385,54 @@ We are grateful to all the contributors who have helped improve this project. Yo - - Saaarthak0102 + + KunikaMakker
- Sarthak + Kunika Makker
- - PrAyAg9 + + yogeswari05
- PrAyAg9 + Chekka Yogeswari
- - 770navyasharma + + vedhcet-07
- Navya Sharma + Vishwas M D
- - Mansi07sharma + + mehul-m-prajapati
- Mansi07sharma + Mehul Prajapati
- - shalini-bhandari + + meghanakn473
- Shalini Bhandari + K N Meghana
- - LitZeus + + Abhishek2634
- Tejas Athalye + Abhishek Farshwal
- - Abhishek2634 + + LitZeus
- Abhishek Farshwal + Tejas Athalye
@@ -442,6 +442,13 @@ We are grateful to all the contributors who have helped improve this project. Yo Subham Singh + + + shalini-bhandari +
+ Shalini Bhandari +
+ Ruksina01 @@ -456,6 +463,15 @@ We are grateful to all the contributors who have helped improve this project. Yo Rahul + + + AE-Hertz +
+ Abhinandan +
+ + + PRASHANTSWAROOP001 @@ -470,8 +486,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Nishita Panchal - - jashwanthbavandlapalli @@ -480,17 +494,17 @@ We are grateful to all the contributors who have helped improve this project. Yo - - Himanshi-m + + Bhum-ika
- Himanshi Maheshwari + Bhumika Sharma
- - Bhum-ika + + Himanshi-m
- Bhumika Sharma + Himanshi Maheshwari
@@ -500,6 +514,8 @@ We are grateful to all the contributors who have helped improve this project. Yo Lokesh11868 + + Anandha-Vihari @@ -513,15 +529,6 @@ We are grateful to all the contributors who have helped improve this project. Yo
Mohith Singh
- - - - - - KunikaMakker -
- Kunika Makker -
@@ -551,6 +558,8 @@ We are grateful to all the contributors who have helped improve this project. Yo Kratik Mandloi + + meghanakn22 @@ -564,15 +573,6 @@ We are grateful to all the contributors who have helped improve this project. Yo
AJ
- - - - - - AE-Hertz -
- Abhinandan -
@@ -595,8 +595,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Rana Jay - - Rahul7raj @@ -634,8 +632,6 @@ We are grateful to all the contributors who have helped improve this project. Yo Imgbot - - IRFANSARI2