-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNotes.txt
117 lines (110 loc) · 3.4 KB
/
Notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Js Date Methods
//new Date() creates a date object with current date and time.
==>toDateString() :- Returns the date portion of the date object.
const a = new Date();//date object
console.log(a.toDateString());
==>getDate() : Returns the day of the month(1 to 31) of a date.
const b = new Date();//date object
console.log(b.getDate());
==>getFullYear() : Return the full year (4 digits) of a date.
const c = new Date();//date object
console.log(c.getFullYear());
==>getMonth() : Return the month(0 to 11)of a date.
const d = new Date();//date object
console.log(d.getMonth());
==>getDay() :-Return the day of the week(0to6) of a date.
==>getHours():- return the hours(0 to 23)of a date.
==>getMinutes():- return the minutes(0 to 59)of a date.
==>getSeconds():- return the seconds(0 to 59) of a date.
==>getMilliseconds() :- return the milliseconds(0 to 999) of a date.
==>getTime() :- return the number of milliseconds since jan 1
const e = new Date();
console.log(e.getDay());
console.log(e.getHours());
console.log(e.getMinutes());
console.log(e.getSeconds());
console.log(e.getMilliseconds());
console.log(e.getTime());
==> Javascript date set methods:-
setDate():- sets the day of the month of a date.
setFullYear() :- sets the full year of a date and also sets month and day.
setHours() :- sets the hours of a date also sets minutes , seconds and milliseconds.
setMilliseconds() :- sets the milliseconds of a date.
setMinutes() :- sets minutes of a date also sets seconds and milliseconds.
setSeconds() :- sets seconds of a date also sets milliseconds.
setMonth() :- sets the month of a date also sets day of the month.
setTime() :- sets a date and time by adding or subtracting a specified number od milliseconds(to/from mid of jan 1 1990)
const f = new Date();
f.setDate(27);
console.log(f);
f.setFullYear(2020,5,26);
console.log(f);
f.setHours(11);
console.log(f);
f.setMinutes(45);
console.log(f);
f.setSeconds(55);
console.log(f);
f.setMilliseconds(730);
console.log(f);
f.setMonth(6);
console.log(f);
f.setTime()
console.log(f);
**********------------------------------------*****************************
Javascript Array Methods
toString()
push()
pop()
shift()
unshift()
concat()
slice()
splice()
reverse()
isArray() - done
indexOf() - done
lastIndexOf() - done
find() - done
findIndex() - done
includes()
entries() - done
every() - done
some() - govindan
fill() - done
copywithin() -done
valueOf() -done
flat() - vignesh vk
from() - done
keys()
delete Operator
length property
var array = [1,2,3];
console.log(array.toString()); // "1,2,3"
var a = ["a", "b", "c"]
console.log(a.push("z"));// ["a","b","c","z"]
console.log(a.pop());// ["a","b","c"]
console.log(a.unshift("x"));//["x","a","b","c"]
console.log(a.shift());// ["a","b","c"]
var a = [1,2] , b = ["a","b"] , c = ["x"];
var concatarray = a.concat(b,c);
console.log(concatarray); // [1,2,"a,"b","x"]
var a = [8,5,2,58] , b =["x","b","f","a"]
console.log(a.sort()); // [2,5,8,58]
console.log(b.sort()); // ["a","b","f","x"]
//splice(index,toindex,e1,..)
var arr = ["a","b","c","d"];
console.log(arr.splice(1,3,"x")); // [b,c,d]
console.log(arr); // ["a","x"]
//slice(start,end)
var abc = [11,22,33,44,55]
var slicearr=abc.slice(2,4);
console.log(slicearr); // [33,44] => new array
//reverse
var a = ["a","b", "mern"];
console.log(a.reverse());
console.log(b.reverse());
//includes
var a = [1,2,3,"abc"];
console.log(a.includes(2));//true
console.log(a.includes("abc"));//true