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

A Tiny JS World task #402

Merged
merged 4 commits into from
Sep 7, 2022
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
69 changes: 69 additions & 0 deletions submissions/franchukv/a-tiny-js-world/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
Refer to https://github.com/OleksiyRudenko/a-tiny-JS-world for the task details
Complete the below for code reviewers' convenience:
Code repository: https://github.com/franchukv/a-tiny-JS-world
Web app: https://franchukv.github.io/a-tiny-JS-world/
*/

// ======== OBJECTS DEFINITIONS ========
const man = {
species: 'human',
gender: 'male',
name: 'Drogo',
status: 'Khal',
hands: 2,
feets: 2,
saying: 'Sheikh Ma Shieraki Anni.',
}

const woman = {
species: 'human',
gender: 'female',
name: 'Daenerys',
status: 'Daenerys of House Targaryen, First with Her Name, Breaker of Chains and Mother of Dragons',
hands: 2,
feets: 2,
saying: 'Drakaris!',
friends: `Fell in love with ${man.name}.`,
}

const dog = {
species: 'dog',
gender: 'male',
name: 'Sharik',
status: "Yard's terrier",
hands: 0,
feets: 4,
saying: 'woof-woof!',
friends: `Only ${man.name} is friends.`,
}

const cat = {
species: 'cat',
gender: 'female',
name: 'Bastet',
status: "Pharaoh's cat",
hands: 0,
feets: 4,
saying: 'Meow, bow to me!',
friends: 'No friends, only servants!'
}

const catwoman = {
species: 'human',
gender: 'female',
name: 'Selina Kyle',
status: "Superhero",
hands: 2,
feets: 2,
saying: cat.saying,
friends: `In astral connection with ${cat.name}.`,
}

// ======== OUTPUT ========
const inhabitants = [man, woman, dog, cat, catwoman];
const properties = ['species', 'gender', 'name', 'status', 'hands', 'feets', 'saying', 'friends'];

inhabitants.forEach((habitant) => {
print(properties.map((property) => habitant[property]).join('; '));
})