-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayJavaScript.js
More file actions
49 lines (42 loc) · 927 Bytes
/
playJavaScript.js
File metadata and controls
49 lines (42 loc) · 927 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const username = 'Max';
let age = 29;
const hasHobbies = true;
age = 30;
// function summarizeUser(userName, userAge, userHasHobby) {
// return (
// 'Name is ' +
// userName +
// ', age is ' +
// userAge +
// ' and the user has hobbies: ' +
// userHasHobby
// );
// }
const summarizeUser = (userName, userAge, userHasHobby) => {
return (
'Name is ' +
userName +
', age is ' +
userAge +
' and the user has hobbies: ' +
userHasHobby
);
};
console.log(summarizeUser(username, age, hasHobbies));
const person = {
name: 'Max',
age: 29,
greet() {
console.log('Hi, I am ' + this.name);
}
};
person.greet();
const hobbies = ['Sports', 'Cooking'];
hobbies.push('Programming');
for (let hobby of hobbies) {
console.log(hobby);
}
console.log(hobbies.map(hobby => 'Hobby: ' + hobby));
//Spread Operator
const copiedArray = [...hobbies];
console.log(copiedArray);