Skip to content

Commit 5d8d1cf

Browse files
committed
some updated
1 parent a38bc52 commit 5d8d1cf

File tree

6 files changed

+29
-16
lines changed

6 files changed

+29
-16
lines changed

arraymethods.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ console.log(filt);
1919

2020
//! Reduce :
2121
const arr1 = [1, 2, 3, 4, 5, 6];
22-
const reduced = arr1.reduce((total, current) => total + current);
22+
const reduced = arr1.reduce((total, current) => total + current, 20);
2323
console.log(reduced);
2424

2525
//? Find average value from reduce

constructorfunc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ var constr1 = new constr();
1010
var constr2 = new constr();
1111
var constr3 = new constr();
1212
console.log(constr1);
13+
console.log(constr2);

currying.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const add = function (c) {
22
return function (b) {
33
return function (a) {
4+
console.log(a, b, c);
45
return a + b + c;
56
};
67
};

life.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
//IIFE in Javascript :
22
// Immidiately invoked function expression
33

4-
var ans = (function () {
5-
var prvtval = 12;
6-
return {
7-
getter: function () {
8-
console.log(prvtval);
9-
},
10-
setter: function (value) {
11-
prvtval = val;
12-
},
13-
};
4+
// var ans = (function () {
5+
// var prvtval = 12;
6+
// return {
7+
// getter: function () {
8+
// console.log(prvtval);
9+
// },
10+
// setter: function (value) {
11+
// prvtval = val;
12+
// },
13+
// };
14+
// })();
15+
16+
(function () {
17+
console.log("Kirtti");
1418
})();

practice.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ const inter = function () {
33
};
44

55
setTimeout(inter, 1000);
6+
7+
console.log(x);
8+
var x = 12;

valuevsref.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
// Value VS Reference Variables
1+
// Value VS Reference Variables
22
// In Javascript always assigns variables by value. But this part is very important: when the assigned value is one of JavaScript’s five primitive type (i.e., Boolean, null, undefined, String, and Number) the actual value is assigned. However, when the assigned value is an Array, Function, or Object a reference to the object in memory is assigned
33

44
let str = "Kirttinath";
55
let str1 = str;
66
str1 = "Kirtti";
77
console.log(str);
8-
console.log(str1);// this gives same output as str
9-
// But in reference case
10-
let obj = {name: 'Kirtti'};
8+
console.log(str1); // this gives same output as str
9+
// But in reference case
10+
let obj = { name: "Kirtti" };
1111
let obj1 = obj;
1212
obj1.name = "Kojha";
1313
console.log(obj);
14-
console.log(obj1);// This will give different output because it is a reference to the original object not creating new one
14+
console.log(obj1); // This will give different output because it is a reference to the original object not creating new one
15+
let a = [1, 2];
16+
let b = a;
17+
b[0] = 3;
18+
console.log(a[0]);

0 commit comments

Comments
 (0)