Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tiny js world #55

Merged
merged 2 commits into from
Mar 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions submissions/madmaxWMFU/a-tiny-JS-world/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* 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 ========
const man = {
name: "Max",
gender: "male",
species: "human",
hands: "2",
legs: "2",
say: () => `Hallo!`,
};

const woman = {
name: "Lena",
gender: "female",
species: "human",
hands: "2",
legs: "2",
say: () => `Bonjour!`,
};

const dog = {
name: "Adolf",
gender: "male",
species: "dog",
hands: "0",
legs: "4",
say: () => `Woof!`,
};

const cat = {
name: "Klara",
gender: "female",
species: "cat",
hands: "0",
legs: "4",
say: () => `Meeow!`,
};

const createSringTemplate = (obj) => {
return [
obj.species,
`<strong>${obj.name}</strong>`,
obj.gender,
obj.hands,
obj.legs,
`<em>${obj.say()}</em>`
].join("; ");
};
// ======== OUTPUT ========
[man, woman, dog, cat].forEach(arr => print(createSringTemplate(arr), 'div'));