@@ -50,7 +50,14 @@ This repository contains a list of JavaScript concepts, functions, methods, and
50
50
- [ if else else if statement] ( #if-else-else-if-statement )
51
51
- [ switch statement] ( #switch-statement )
52
52
- [ Functions] ( #functions )
53
- - [ Arrow Functions] ( #arrow-function )
53
+ - [ Named Function] ( #named-function )
54
+ - [ Anonymous Function] ( #anonymous-function )
55
+ - [ Arrow Functions] ( #arrow-function )
56
+ - [ Immediately Invoked Function Expression (IIFE)] ( #iife )
57
+ - [ Higher Order Function] ( #higher-order-functions )
58
+ - [ Function Declaration] ( #function-declaration )
59
+ - [ Function Expression] ( #function-expression )
60
+ - [ Function Constructor] ( #function-constructor )
54
61
- [ Scope] ( #scope )
55
62
- [ Block Scope] ( #block-scope )
56
63
- [ Function Scope] ( #function-scope )
@@ -2353,6 +2360,11 @@ function name(parameter1, parameter2, parameter3) {
2353
2360
- Named Function
2354
2361
- Anonymous Function
2355
2362
- Arrow Function
2363
+ - IIFE
2364
+ - Higher-Order Function
2365
+ - Function Expression
2366
+ - Function Declaration
2367
+ - Function Constructor
2356
2368
2357
2369
[Back to Top⤴️](#table-of-contents)
2358
2370
@@ -2406,6 +2418,71 @@ const name = () => {
2406
2418
2407
2419
[Back to Top⤴️](#table-of-contents)
2408
2420
2421
+ ## IIFE
2422
+
2423
+ An IIFE (Immediately Invoked Function Expression) is a JavaScript function that runs as soon as it is defined.
2424
+
2425
+ ` ` ` javascript
2426
+ (function () {
2427
+ console .log (" Hello World!" );
2428
+ })();
2429
+ ` ` `
2430
+
2431
+ [Back to Top⤴️](#table-of-contents)
2432
+
2433
+ ## Higher-Order Functions
2434
+
2435
+ A higher-order function is a function that takes another function as an argument or returns a function as a result.
2436
+
2437
+ ` ` ` javascript
2438
+ function greet () {
2439
+ return " Hello World!" ;
2440
+ }
2441
+
2442
+ function greetUser (greet ) {
2443
+ return greet ();
2444
+ }
2445
+
2446
+ console .log (greetUser (greet)); // Output: "Hello World!"
2447
+ ` ` `
2448
+
2449
+ [Back to Top⤴️](#table-of-contents)
2450
+
2451
+ ## Function Expression
2452
+
2453
+ A function expression is a function that is assigned to a variable.
2454
+
2455
+ ` ` ` javascript
2456
+ const greet = function () {
2457
+ return " Hello World!" ;
2458
+ }
2459
+
2460
+ console .log (greet ()); // Output: "Hello World!"
2461
+ ` ` `
2462
+
2463
+ ## Function Declaration
2464
+
2465
+ A function declaration is a function that is defined using the function keyword followed by the function name.
2466
+
2467
+ ` ` ` javascript
2468
+ function greet () {
2469
+ return " Hello World!" ;
2470
+ }
2471
+
2472
+ console .log (greet ()); // Output: "Hello World!"
2473
+ ` ` `
2474
+
2475
+ ### Function Constructor
2476
+
2477
+ A function constructor is a function that is used to create new objects.
2478
+
2479
+ ` ` ` javascript
2480
+ const greet = new Function (" return 'Hello World!'" );
2481
+ console .log (greet ()); // Output: "Hello World!"
2482
+ ` ` `
2483
+
2484
+ [Back to Top⤴️](#table-of-contents)
2485
+
2409
2486
## Scope
2410
2487
2411
2488
Scope refers to the visibility of variables in JavaScript. There are three types of scope in JavaScript:
@@ -2512,36 +2589,6 @@ function multiply(a) {
2512
2589
console .log (multiply (2 )(3 )(4 )); // Output: 24
2513
2590
` ` `
2514
2591
2515
- ## IIFE
2516
-
2517
- An IIFE (Immediately Invoked Function Expression) is a JavaScript function that runs as soon as it is defined.
2518
-
2519
- ` ` ` javascript
2520
- (function () {
2521
- console .log (" Hello World!" );
2522
- })();
2523
- ` ` `
2524
-
2525
- [Back to Top⤴️](#table-of-contents)
2526
-
2527
- ## Higher-Order Functions
2528
-
2529
- A higher-order function is a function that takes another function as an argument or returns a function as a result.
2530
-
2531
- ` ` ` javascript
2532
- function greet () {
2533
- return " Hello World!" ;
2534
- }
2535
-
2536
- function greetUser (greet ) {
2537
- return greet ();
2538
- }
2539
-
2540
- console .log (greetUser (greet)); // Output: "Hello World!"
2541
- ` ` `
2542
-
2543
- [Back to Top⤴️](#table-of-contents)
2544
-
2545
2592
## Dates
2546
2593
2547
2594
JavaScript provides a built-in Date object that can be used to work with dates and times.
0 commit comments