1 parent 0b69184 commit dca5d8cCopy full SHA for dca5d8c
1 file changed
03_functions/03_function_basics.js
@@ -0,0 +1,25 @@
1
+//There is a slight difference between method and function.
2
+//method is connected with the objects and functions are not, we can create function what ever we needs
3
+
4
+//Now in js inside a function we can pass another function as an argument,then that function is called as a call back function
5
6
7
+function abc(){
8
+ console.log("hello");
9
10
+}
11
12
+function myFunc(abc){
13
+ return abc;
14
15
16
17
18
+//forEach loop
19
20
+let arr = [1,2,3,4,5]
21
22
+arr.forEach(function printVal(val, idx,arr){
23
+ console.log(val,idx,arr);
24
25
+})
0 commit comments