JavaScript Object Reference

Full Stack Web Development Courses with Real-time projects Start Now!!

Program 1

class Test
{
    constructor()
    {
        console.log("Constructor .......")
        this.a=10
    }
    inrcrement()
    {
        ++this.a
    }
}


T1=new Test()  // define

T2=T1  // Reference

T1.inrcrement()
T1.inrcrement()

console.log(T2.a)


// T1=new Test() // define object
// T2=new Test() //define object

// T1.inrcrement()
// T1.inrcrement()


// console.log(T2.a)

 

Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google

courses
Image

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *