Skip to content

Commit 66e8610

Browse files
Balashov NikitaOlegLustenko
authored andcommitted
classwork-9
1 parent 579abdf commit 66e8610

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const myJson = {
2+
"name": "my library",
3+
"version": 10,
4+
"dependency": {
5+
"react": "^16.4.0",
6+
"babel": false,
7+
},
8+
}
9+
10+
myJson.int = myJson;
11+
12+
console.log(myJson);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Class work 9</title>
6+
</head>
7+
<body>
8+
<script src="src/main.js"></script>
9+
<script src="general.json"></script>
10+
</body>
11+
</html>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
'use strict';
2+
3+
const myobj = {
4+
methodES5: function() {
5+
return `ES5`
6+
},
7+
methodES6() {
8+
return `ES6`
9+
},
10+
set length(version) {
11+
myobj.version = version
12+
},
13+
get length() {
14+
return myobj.version
15+
}
16+
}
17+
18+
console.log(myobj.methodES5())
19+
console.log(myobj.methodES6())
20+
21+
function add(a, b) {
22+
return a + b
23+
}
24+
25+
const sumES6 = (a, b) => a + b
26+
27+
const sum2ES6 = (a, b) => {
28+
return a + b
29+
}
30+
31+
console.log(add(2, 12))
32+
console.log(sumES6(0, 6))
33+
console.log(sum2ES6(2, 4))
34+
35+
const returnIyourName = (name) => `I am your ${name}`
36+
const returnObjectWithName = (name, id, version) => {
37+
return {name, id, version}
38+
}
39+
const returnObjectWithNameV2 = (name) => ({name})
40+
41+
console.log(returnIyourName(`Nikita`))
42+
console.log(returnObjectWithName(`Nikita`, 10, `0.0.1`))
43+
console.log(returnObjectWithNameV2(`Nikita`))
44+
45+
const userArray = [`Name1`, `Name2`, `Name3`]
46+
47+
const returnObject = arr => arr.map(name => ({name}))
48+
49+
console.log(returnObject(userArray))
50+
51+
52+
const obj = {
53+
name: `student`,
54+
id: 0,
55+
salary: `+500$`
56+
}
57+
58+
const test = () => this
59+
60+
//TASK with this
61+
62+
let book1 = {
63+
name: `Learn Ruby`,
64+
pages: 200,
65+
showPages: showPages
66+
}
67+
68+
let book2 = {
69+
name: `Be a pro in JS`,
70+
pages: 10,
71+
showPages: showPages
72+
}
73+
74+
function showPages() {
75+
return this.pages
76+
}
77+
78+
console.log(book1.showPages())
79+
console.log(book2.showPages())

0 commit comments

Comments
 (0)