-
Notifications
You must be signed in to change notification settings - Fork 0
/
play.js
70 lines (45 loc) · 1.13 KB
/
play.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
// const person = {
// name: 'abhi',
// age: 29,
// greet() {
// //console.log(this.name);
// }
// };
// person.greet();
// const hobbies = ['badminton', "cricket"];
// // console.log (hobbies.map(hobby => "Hobby: " + hobby
// // ));
// // console.log(hobbies);
// // const copyarray = hobbies.slice();
// // console.log(copyarray);
// // const copyarray = [hobbies];
// // console.log(copyarray);
// // hobbies.push("laughing");
// // console.log(hobbies);
// // const copyarray = [...hobbies];
// // console.log(copyarray);
// const copiedperson = {...person}
// console.log(copiedperson);
// console.log(person);
// const somefun = (...args) => {
// return args;
// }
// console.log(somefun (1,2,3,4,6,9));
person = {
name:'abhilash',
age:34,
greet() {
console.log("hi there: " + this.name);
}
};
//person.greet();
const printanother = ({name, age}) => {
// console.log(name, age);
}
printanother(person);
// object destructuring
const {name, age} = person;
//console.log(name, age);
const hobbies = ['cycling', 'walking'];
const [hob1, hob2]=hobbies;
console.log(hob1, hob2);