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 D1telo v1.0 #739

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
59 changes: 59 additions & 0 deletions submissions/D1telo/a-tiny-js-world/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { print } from "./js/lib.js";
/* 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/D1telo/a-tiny-JS-world/blob/master/index.js
Web app: https://d1telo.github.io/tiny-js/
*/

// ======== OBJECTS DEFINITIONS ========
// Define your objects here

const dog = {
species: 'dog',
name: 'Toby',
gender: 'male',
legs: 4,
hands: null,
voice: 'woof-woof!'
};

const cat = {
species: 'cat',
name: 'Tom',
gender: 'female',
legs: 4,
hands: null,
voice: 'meow-meow!'
};

const man = {
species: 'human',
name: 'Denys',
gender: 'male',
legs: 2,
hands: 2,
voice: 'Glory Ukraine!'
};

const woman = {
species: 'human',
name: 'Anna',
gender: 'female',
legs: 2,
hands: 2,
voice: 'Support Ukraine!'
};

const catWoman = Object.create(cat);
catWoman.species = 'CatWoman';
catWoman.name = 'Jesica';
catWoman.gender = 'female';
catWoman.legs = 2;
catWoman.hands = 2;

const speciesAll = [dog, cat, man, woman, catWoman];
const qualityPersonage = ['species', 'name', 'gender', 'legs', 'hands', 'voice'];

speciesAll.map(personage => print(qualityPersonage.map(quality => personage[quality]).join(' - ')));