# JavaScript-Creation of Objects

Creation of objects in Javascript:- there are three ways of creating of object in JavaScript.....these are

1. Direct method
    
    **let obj={id: 101, name: "Pushpdeep", Batch: 2024}**
    
    **console.log(obj)**
    
    here id, name, and batch are keys and 101, Pushpdeep and 2024 are the corresponding values of keys, That's why in javascript we say objects are represented in the form of key and value pairs.
    
2. Using new keyword
    
    **let em=new object()**
    
    **em.id=101;**
    
    **em.name="Pushdeep"**
    
    **em.batch=2024**
    
    **console.log(em)**
    
    here em is the name of the object and this object() is already there inside JavaScript.
    
3. Using the constructor of the function
    
    **function spg(i,n,b)**
    
    **{**
    
    **this.id=i;**
    
    **this.name=n;**
    
    **this.batch=b;**
    
    **}**
    
    **const e=new spg(101,"Pushpdeep",2024)**
    
    **console.log(e)**
    
    in this method, we use **this** keyword to give values to the keys
