Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

new operator in javascript

/*The new operator is used for creating a user-defined object type
instance of one of the builtin object types that has a constructor 
function.*/


function Circle(radius){
  console.log('this',this);
 this.radius=radius;
 this.draw=function(){
    console.log('draw');
 }
}
const circle = new Circle(1);

//Output
     this
     circle{
       draw : f(),
       radius: 1
           }
 
PREVIOUS NEXT
Tagged: #operator #javascript
ADD COMMENT
Topic
Name
7+2 =