-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrowFunc.js
More file actions
34 lines (23 loc) · 744 Bytes
/
ArrowFunc.js
File metadata and controls
34 lines (23 loc) · 744 Bytes
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
const theFunc = () => {
console.log("Arrow function");
}
theFunc();
const nextFunc= ()=> console.log("Hello World!");//no {} ,Works if function have only one statement
nextFunc();
const nexthFunc= (value)=> console.log("Hello World! " + value);
nexthFunc("Rasheed");
const nextsFunc= value=> console.log("Hello World! " + value);//no (), works if there is only one parameters
nextsFunc("notRasheed");
class Person{
constructor(name,age){
this.name = name;
this.age = age;
}
profile(){
return "My name is " + this.name + " and i am " + this.age + " Years old.";
}
}
const person = new Person("Rasheed", 26);
console.log(person.name);
console.log(person.age);
console.log(person.profile());