class Creature {
constructor(age, brain, eyes) {
this.age = age;
this.brain = brain;
this.eyes = eyes;
}
}
class People extends Creature {
constructor(age, brain, eyes, intelect) {
super(age, brain, eyes);
this.intelect = intelect;
}
}
class DomesticAnimals extends Creature {
constructor(age, brain, eyes, InHome) {
super(age, brain, eyes);
this.InHome = InHome;
}
}
class WildAnimals extends Creature {
constructor(age, brain, eyes, InForest) {
super(age, brain, eyes);
this.InForest = InForest;
}
}
class OrdinaryBirds extends Creature {
constructor(age, brain, eyes, gentle) {
super(age, brain, eyes);
this.gentle = gentle;
}
}
class ProdetoryBirds extends Creature {
constructor(age, brain, eyes, wild) {
super(age, brain, eyes);
this.wild = wild;
}
}
class OrdinaryFish extends Creature {
constructor(age, brain, eyes, toothless) {
super(age, brain, eyes);
this.toothless = toothless;
}
}
class ProdetoryFish extends Creature {
constructor(age, brain, eyes, WithTooth) {
super(age, brain, eyes);
this.sharpTooth = WithTooth;
}
}
class IncectWithLeg extends Creature {
constructor(age, brain, eyes, WithLag) {
super(age, brain, eyes);
this.WithLag = WithLag;
}
}
class IncectWithoutLeg extends Creature {
constructor(age, brain, eyes, WithoutLeg) {
super(age, brain, eyes);
this.Withouteg = WithoutLeg;
}
}
const person = new People(18, 1, 2, "bor");
const cow = new DomesticAnimals(4, 1, 2, "true");
const lion = new WildAnimals(5, 1, 2, "true");
const parrot = new OrdinaryBirds(1, 1, 2, "true");
const eagle = new ProdetoryBirds(10, 1, 2, "carnivore");
const fish = new OrdinaryFish(1, 1, 2, "true");
const shark = new ProdetoryFish(2, 1, 2, "sharpTooth");
const ant = new IncectWithLeg(1, 1, 2, "six legs");
const worm = new IncectWithoutLeg(2, 1, 2, "true");
console.log(person);
console.log(cow);
console.log(lion);
console.log(parrot);
console.log(eagle);
console.log(fish);
console.log(shark);
console.log(ant);
console.log(worm);π3π₯1
I'M_DEVELOPERπ¨βπ»
class Creature { constructor(age, brain, eyes) { this.age = age; this.brain = brain; this.eyes = eyes; } } class People extends Creature { constructor(age, brain, eyes, intelect) { super(age, brain, eyes); this.intelect = intelect;β¦
Bugungi vazifa kerak bo'lib qolar kimgadirπ
π₯1π¨βπ»1
Kanaldan uzoqlashmang qiziqarli narsalar hali oldinda π
π₯1π1
const dataObject = {
age: 25,
name: "John",
isActive: true,
hobbies: ["reading", "sports"],
address: { city: "New York", zip: 10001 },
greet: function () {
return "Hello";
},
id: null,
};
function importObject(obj) {
const result = [];
for (const key in dataObject) {
const value = obj[key];
const type = typeof value;
let category;
if (type === "object" || type === "function") {
category = "non-primitive";
} else {
category = "primitive";
}
result.push({ key, value, type, category });
}
return result;
}
const result = importObject(dataObject);
console.log(result);β€1π₯1
I'M_DEVELOPERπ¨βπ»
const dataObject = { age: 25, name: "John", isActive: true, hobbies: ["reading", "sports"], address: { city: "New York", zip: 10001 }, greet: function () { return "Hello"; }, id: null, }; function importObject(obj) { const result = [];β¦
bugungi vazifadan parcha
π₯1π1π±1
const mixedArray = [
42,
"Hello",
true,
{ name: "Alice" },
[1, 2, 3],
null,
undefined,
function () {},
];
function CheckDataTypes() {
const counts = {
number: 0,
string: 0,
boolean: 0,
object: 0,
undefined: 0,
function: 0,
};
for (const element of mixedArray) {
const type = typeof element;
if (type === "object") {
if (type === null) {
counts.object++;
} else {
counts.object++;
}
} else if (type in counts) {
counts[type]++;
}
}
return counts;
}
const result = CheckDataTypes(mixedArray);
console.log(result);
