Search
 
SCRIPT & CODE EXAMPLE
 

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
           }
Comment

PREVIOUS NEXT
Code Example
Javascript :: nextjs localstorage 
Javascript :: jquery ready 
Javascript :: javascript find all occurrences in string 
Javascript :: object exists in array javascript 
Javascript :: javascript switch case regex 
Javascript :: DataTypes Time sequelize 
Javascript :: add tailwind to create react app 
Javascript :: getusermedia example 
Javascript :: js for in object 
Javascript :: react-select default menu open 
Javascript :: yarn build react 
Javascript :: prop-types 
Javascript :: how to get ip address javascript 
Javascript :: javascript subtract 2 dates get difference in minutes 
Javascript :: react toastify dark mode 
Javascript :: check if type is blob javascript 
Javascript :: vuejs input text 
Javascript :: async arrow function 
Javascript :: ecmascript 7 getmonth as 2 digits 
Javascript :: uuid timestamp for javascript 
Javascript :: see all functions in a website with console 
Javascript :: javascript classlist add 
Javascript :: order array of objects by id javascript 
Javascript :: csurf npm 
Javascript :: javascript format price 
Javascript :: javascript check less width of window 
Javascript :: javascript caesar cipher 
Javascript :: react environment 
Javascript :: javascript check if array has duplicates 
Javascript :: Reading Time with jquery 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =