From aea2ccf423c72ead4e3473625c8433774d97b871 Mon Sep 17 00:00:00 2001 From: Yuliia Dikun <107618913+YuliiaDikun@users.noreply.github.com> Date: Tue, 16 Aug 2022 18:45:37 +0300 Subject: [PATCH] create tiny js world (#191) --- submissions/dikun/tiny-js-world/index.js | 82 ++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 submissions/dikun/tiny-js-world/index.js diff --git a/submissions/dikun/tiny-js-world/index.js b/submissions/dikun/tiny-js-world/index.js new file mode 100644 index 0000000000..82fb406ca0 --- /dev/null +++ b/submissions/dikun/tiny-js-world/index.js @@ -0,0 +1,82 @@ +/* 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: "Bim", + gender: "male", + legs: 4, + hands: 0, + talk: "woof!" +}; + +const cat = { + species: "cat", + name: "Tom", + gender: "male", + legs: 4, + hands: 0, + talk: "meow!" +}; + +const man = { + species: "human", + name: "Jack", + gender: "male", + legs: 2, + hands: 2, + talk: "Captain Jack Sparrow!" +}; + +const woman = { + species: "human", + name: "Elizabeth", + gender: "female", + legs: 2, + hands: 2, + talk: "He's A Pirate." +}; + +const catwoman = { + species: "human", + name: "Lisa", + gender: "female", + legs: 2, + hands: 2 +}; + +catwoman.talk = cat.talk; + +const inhabitants = [dog, cat, man, woman, catwoman]; +const properties = ["species", "name", "gender", "legs", "hands", "talk"]; + +const inhabitantsDescr = inhabitants.map((inhabitan) => properties.map(property => inhabitan[property])); + +inhabitantsDescr.map((resident) => print(resident.join("; "))); + +// ======== 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'); + */ + +