// one way to have multiple data about a student is with an array
// for each piece of data
const studentNames = ["Fowad", "Emil", "Zoey"];
const studentAges = [32, 25, 28];
console.log(studentNames);
console.log(studentAges);
// Another, more ergonomic way is with objects
const students = [
{ name: "Fowad", age: 32 },
{ name: "Emil", age: 25, teacher: true },
{ name: "Zoey", age: 28 },
];
console.log(students);
// We can access properties with `.`
console.log(students[0].name);
for (let i = 0; i < students.length; i++) {
const currentStudent = students[i];
console.log(typeof currentStudent);
console.log(currentStudent.name);
}
students.push({ name: "Ahmad", age: 27 });
// One object that we have seen before
const Math = {
random: function () {
return 42;
},
round: function (x) {},
};
function a() {
// add to call stack
b();
return "a";
// remove from call stack
}
function b() {
//throw 'hello';
return "b";
}
a();
function bookPlaneTickets() {
// draw
console.log("Plane tickets booked");
requestVacationDays();
// draw
}
function bookHotel() {
console.log("Hotel booked");
// draw
planItinerary();
// draw
}
function requestVacationDays() {
// draw
console.log("Vacation days requested");
// draw
}
function planItinerary() {
console.log("Itinerary done");
// draw
}
function planTrip() {
bookPlaneTickets();
// draw
bookHotel();
// draw
console.log("Trip planned");
}
// draw
planTrip();
// draw