How should we use this and new keywords in javascript? | SoloLearn: Learn to code for FREE!

0

How should we use this and new keywords in javascript?

function Person(name,age,std){ this.studname=name; this.studage=age; this.studstd=std; } var student1 = new Person("alpha",20,5); var student2= new Person("Omega",21,10); document.write(student1.name+"is studying in"+student1.std+"but"+student2.name+"is good"); Is this right?

7/2/2020 9:29:14 AM

C Alpha Beraka

1 Answer

New Answer

0

I think the code is right, but I didn't understood the question 🤔