const user1 ={name: myName,// myName was defined in the strings section...age:19,isLoggedIn:false,favoriteColor:"blue",};
// you could have an array of objectsconst users =[user1, user2, user3];
Functions
// the simplest function with NO PARAMETERSfunctionsayHi(){
console.log("Hi");}// function usage:sayHi();
// a function with a parameter// function definition:functionuserAge(userObject){
console.log(userObject.age);return userObject.age;}// function usage// ... assuming user1 was defined in objects section above// user1 is "passed in" as the userObject parameteruserAge(user1);
// functions can also be written as constantsconstuserAge=(userObject)=>{
console.log(userObject.age);return userObject.age;};// usageuserAge(user1);