From 7298ead20b1ac0f6a641d9bfd241acd5a0f8d781 Mon Sep 17 00:00:00 2001 From: asa Date: Mon, 8 Aug 2022 16:49:24 +0300 Subject: [PATCH 1/3] preoop task --- .../index.html | 68 ++++++++++++++++ .../index.js | 79 +++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.html create mode 100644 submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.js diff --git a/submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.html b/submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.html new file mode 100644 index 0000000000..b64f4fcb7f --- /dev/null +++ b/submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.html @@ -0,0 +1,68 @@ + + + + + A Tiny JS World + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

A Tiny JS World

+
+ This tiny world is created as a part of + A Tiny JS World project +
+
+
+
+

This world is inhabited by

+

(world's source code)

+
+ + + + + diff --git a/submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.js b/submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.js new file mode 100644 index 0000000000..d99060268a --- /dev/null +++ b/submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.js @@ -0,0 +1,79 @@ +/* Refer to https://github.com/OleksiyRudenko/a-tiny-JS-world for the task details + Complete the below for code reviewers' convenience: + + Code repository: _put repo URL here_ + Web app: _put project's github pages URL here_ + */ + +// ======== OBJECTS DEFINITIONS ======== +// Define your objects here +const dog = { + species: 'dog', + name: 'Toby', + gender: 'male', + legs: 4, + hands: 0, + saying: 'woof-woof!' +} + +const cat = { + species: 'cat', + name: 'Aimi', + gender: 'female', + legs: 4, + hands: 0, + saying: 'meow!' +} + +const man = { + species: 'human', + name: 'Ihor', + gender: 'male', + legs: 2, + hands: 2, + saying: 'Hi!' +} + +const woman = { + species: 'human', + name: 'Marina', + gender: 'female', + legs: 2, + hands: 2, + saying: 'Hello!' +} + +const catWoman = Object.create(cat); +catWoman.name = 'Cat-Woman'; +catWoman.species = 'human'; +catWoman.legs = 2; +catWoman.hands = 2; +catWoman.gender = 'female'; + +const inhabitants = [dog, cat, man, woman, catWoman]; + +function aboutObj(obj) { + return `${obj.saying} I'm a ${obj.species}. My gender is ${obj.gender}. My name is ${obj.name}. I have ${obj.legs} legs, ${obj.hands} hands`; +} + +inhabitants.forEach(item => print(aboutObj(item))); +// ======== OUTPUT ======== +/* Use print(message) for output. + Default tag for message is
. Use print(message,'div') to change containing element tag.
+
+   Message can contain HTML markup. You may also tweak index.html and/or styles.css.
+   However, please, REFRAIN from improving visuals at least until your code is reviewed
+   so code reviewers might focus on a single file that is index.js.
+   */
+
+/* Print examples:
+   print('ABC');
+   print('ABC');
+   print('ABC', 'div');
+
+   print('human; John; male; 2; 2; Hello world!; Rex, Tom, Jenny');
+   print('human; John; male; 2; 2; Hello world!; Rex, Tom, Jenny');
+   print('human; John; male; 2; 2; Hello world!; Rex, Tom, Jenny', 'div');
+   */
+
+

From cb3bf1473925a150e96c0787243ab335af657e95 Mon Sep 17 00:00:00 2001
From: AsaMitaka 
Date: Mon, 15 Aug 2022 22:27:26 +0300
Subject: [PATCH 2/3] deleted index.html file

---
 .../index.html                                | 68 -------------------
 1 file changed, 68 deletions(-)
 delete mode 100644 submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.html

diff --git a/submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.html b/submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.html
deleted file mode 100644
index b64f4fcb7f..0000000000
--- a/submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.html	
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-    
-    A Tiny JS World
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-
-
-    
- -
-

A Tiny JS World

-
- This tiny world is created as a part of - A Tiny JS World project -
-
-
-
-

This world is inhabited by

-

(world's source code)

-
- - - - - From ca631fbeb6382dcca75befe14d8a42bc3cb5005e Mon Sep 17 00:00:00 2001 From: AsaMitaka Date: Tue, 16 Aug 2022 16:40:28 +0300 Subject: [PATCH 3/3] rename function name, added semicolons after objects --- .../Building a Tiny JS World (pre-OOP)/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.js b/submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.js index d99060268a..8c6a573842 100644 --- a/submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.js +++ b/submissions/asaMitaka/Building a Tiny JS World (pre-OOP)/index.js @@ -14,7 +14,7 @@ const dog = { legs: 4, hands: 0, saying: 'woof-woof!' -} +}; const cat = { species: 'cat', @@ -23,7 +23,7 @@ const cat = { legs: 4, hands: 0, saying: 'meow!' -} +}; const man = { species: 'human', @@ -32,7 +32,7 @@ const man = { legs: 2, hands: 2, saying: 'Hi!' -} +}; const woman = { species: 'human', @@ -41,7 +41,7 @@ const woman = { legs: 2, hands: 2, saying: 'Hello!' -} +}; const catWoman = Object.create(cat); catWoman.name = 'Cat-Woman'; @@ -52,7 +52,7 @@ catWoman.gender = 'female'; const inhabitants = [dog, cat, man, woman, catWoman]; -function aboutObj(obj) { +function tellAboutObj(obj) { return `${obj.saying} I'm a ${obj.species}. My gender is ${obj.gender}. My name is ${obj.name}. I have ${obj.legs} legs, ${obj.hands} hands`; }