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