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 world pre-OOP #618

Merged
merged 12 commits into from
Sep 27, 2022
57 changes: 57 additions & 0 deletions submissions/YuraZagor/tiny world pre-oop/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const dog = {
species: "dog",
name: "Jeff",
gender: "male",
paws: 4,
tail: 1,
saying: "bow-wwou!",
};
const cat = {
species: "cat",
name: "Lucky",
gender: "female",
paws: 4,
tail: 1,
saying: "meaaawurrr!",
};
const woman = {
species: "human",
name: "Maria",
gender: "female",
legs: 2,
hands: 2,
saying: "Are U hungry, dear?",
};
const man = {
species: "human",
name: "Grumio",
gender: "male",
legs: 2,
hands: 2,
saying: "Wanna beer with ice-cream!",
};
const cat_woman = {
species: "human",
name: "Anabelle",
gender: "female",
legs: 2,
hands: 2,
};
const inhabitants = [dog, cat, woman, man, cat_woman,];

dog.friend = [man.name, woman.name, cat.name].join(", ");
cat.friend = woman.name;
woman.friend = cat.name;
man.friend = [woman.name, dog.name].join(", ");
cat_woman.friend = woman.name;

cat_woman.saying = cat.saying;

inhabitants.forEach((inhabitant)=>{
const {species, name, gender, legs, paws, hands, tail, saying, friend} = inhabitant;
const inhabitantProperties = [species, name, gender, legs ? legs : paws, hands ? hands : tail, saying, friend]

inhabitantProperties('; '),'div')
})