// object literals

const blogs = [
    {
        title: "Front end and back end programming", likes: 30
    },
    {
        title: "How to do with react.js", likes: 13
    }
];
// console.log(blogs)

let user = {
    name: "David",
    age: 36,
    email: "davidaster007@gmail.com",
    location: "Wien",
    blogs: [
        { title: "Front end and back end programming", likes: 30 },
        { title: "How to do with react.js", likes: 13 }
    ],

    login() {
        console.log(`${this.name} is logged in!`)
    },

    logout() {
        console.log(`${this.name} is logged out!`)
    },

    logBlog() {
        // for (let i = 0; i<this.blogs.length; i++) {
        // console.log(`${i + 1}: ${this.blogs[i]}`)
        // console.log(this)
        this.blogs.forEach(blog => {
            console.log(blog.title, blog.likes)
        });
        // }
        // console.log(this)
    }

    // login: function () {
    //     console.log(`${this.name} is logged in!`)
    // },
    // logout: function () {
    //     console.log(`${this.name} is logged out!`)
    // },

    // logBlog:function() {
    //     // for (let i = 0; i<this.blogs.length; i++) {
    //     // console.log(`${i + 1}: ${this.blogs[i]}`)
    //     // console.log(this)
    //     this.blogs.forEach(blog => {
    //         console.log(`${blog}`)
    //     });
    //     // }
    //     console.log(this)
    // }

};

// console.log(user)
// console.log(user.name)
// user.age = 40;

// console.log(user)
// console.log(user["email"])

// const key = "location";
// user[key] = "New York" // user[location] = "New York"
// console.log(user)
// console.log(typeof user)

// user.login()
// user.logout()

// const name = "Jozica"

user.logBlog()
// console.log(this)


