const a = '7';
const b = 10;
// console.log(parseInt(a) + parseInt(b)); //concatenate - join
// typed language - dynamic
//DRY principle - DONT REPEAT YOURSELF
const car = {
tires: 4,
doors: 4,
headlamp: 2,
fogLight: 0,
color: 'red',
}
const car2 = {
tires: 4,
doors: 2,
headlamp: 2,
fogLight: 2,
color: 'blue',
}
class Array {
list = [];
constructor() {
this.list = list;
}
map() {
}
filter() {
}
}
class Car {
constructor(tires = 4,
doors = 0,
headlamp = 0,
fogLight = 0,
color = '',
tail = true,
)
{
this.color = color;
this.doors = doors;
this.headlamp = headlamp;
this.fogLight = fogLight;
this.tires = tires;
this.tail = tail;
}
setHeadLamp(value) {
this.headlamp = value;
}
}
const car3 = new Car();
car3.setHeadLamp(8)
const covertibleCar = new Car(4, 3);
covertibleCar.setHeadLamp(6);
// console.log('1st car: ', car)
// console.log('2nd car: ',car2)
// console.log('3rd car: ',car3)
// console.log('4th car: ',covertibleCar)
// ARRAY
const list1 = [];
const list = ["Ade", 6, ["car", "truck", "bicycle"]];
list.push("Samson");
list.push("House");
list.push("Samson");
list.push("Pen");
console.log('array length: ', list.length)
console.log('1st item of array: ', list[0])
console.log('last item of array: ', list[2])
console.log('last item of array: ', list[list.length - 1])
console.log(list.indexOf("Samson"))
console.log(list.indexOf("Pen"));
// keys and values
console.log('something is here')