Friday, September 21, 2018

Access modifer in javascript


function Circle(radius){

//Private field
var value=20;

//Privdelege field
this.Radius = radius;

// PI is static field
Circle.PI = 3.4;

//Privdelege function
this.CalculateArea = function(){
return Circle.PI * this.Radius * this.Radius;
}

//public function
Circle.prototype.getRadius = function (){
this.Radius ;
}
}

No comments:

Post a Comment

Find the value from array when age is more than 30

 const data = [   { id: 1, name: 'Alice', age: 25 },   { id: 2, name: 'Bob', age: 30 },   { id: 3, name: 'Charlie', ...