forked from alirezaed/JSLearning0005
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app4-3.js
141 lines (93 loc) · 2.2 KB
/
app4-3.js
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//Destructuring
//*array
//*object
// const person ={
// name:"ali",
// age:12,
// lastname:"rezaei"
// }
// const name = person.name;
// const lastname = person.lastname;
// const { name : firstName,lastname } = person;
// person.name = "jafar";
// console.log(firstName,lastname);
// const arr = ["Apple","Orange","dasdas","aasda"];
// // const frute1 = arr[0];
// // const frute2 = arr[1];
// const [frute1,,frute2] = arr;
// console.log(frute1,frute2);
// function sample(){
// const x = function(){
// }
// const y = function(){
// }
// return [x,y]
// }
// //const myarr = sample();
// // const first =myarr[0];
// const [first,second] = sample();
//spread operator
// const student={
// avg:20,
// lastname:'hasani'
// }
// const person={
// height:180
// }
// const student2={
// // avg:student.avg,
// // lastname:student.lastname,
// fathername : 'reza',
// avg:33,
// ...student,
// ...person
// }
// console.log(student2);
// function sum(...numbers){
// let s =0;
// numbers.forEach(i=>{
// s+=i;
// });
// return s;
// }
// console.log(sum(3,4,5,6));
// const arr1 = [32,4,5,6];
// const arr2 = [32,23,43];
// const arr3 = [...arr2,...arr1,424];
// console.log(arr3);
//Arrow Function
// const ss = function (firstname,lastname){
// return firstname + " " + lastname;
// }
// const ss = (firstname,lastname) => {
// return firstname + " " + lastname;
// }
// const ss = (firstname,lastname) => firstname + " " + lastname;
// const square = input => input * input;
// const noinput = () => "no input";
// console.log(noinput());
// const arr1 = [32,4,5,6];
// arr1.map(item=> "This is :" + item);
// console.log(arr1.map(item=> "This is :" + item));
// const a = a=>b=>c=>d=>a*b+c*d;
// console.log(a(3)(4)(3)(2));
class Person{
constructor(name){
this.name = name;
}
sayHello1(){
console.log('sayHello1 called');
}
}
class Student extends Person {
constructor(name,age){
super(name);
this.age = age;
}
sayHello2=()=>{
this.sayHello1();
}
}
const std1 = new Student("ALI",23);
std1.sayHello2();
console.log(std1);