• Objects

    An object in programming is like a container that holds things. It can be used to store information like a box can store toys. For example, we could create an object called "cat" and it could have different pieces of information inside it like the cat's name, its color, or even how many lives it has left. Objects help us keep track of all the pieces of information we need for a program.

      • Map, Dictionary, Variable Objects

      • Javascript

        Example of object in javascript.
        var person = {
        	name: 'John',
        	age: 36
        };
        
        console.log(person['name']); // John
        console.log(person['age']); // 36
      • Class Objects

      • Javascript

        Example of class object in javascript.
        class Person {
        	constructor(name, age) {
        		this.name = name;
        		this.age = age;
        	}
        
        	greet() {
        		console.log('Hello my name is ' + this.name);
        	}
        }
        
        var human = new Person('John', 36);
        
        console.log(human.name); // John
        console.log(human.age); // 36
        human.greet(); // Hello my name is John