Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

methods javascript

//Method is indicated by *
//Constructor Function
function BellBoy (name, age, hasWorkPermit, languages) {
  this.name = name;
  this.age = age;
  this.hasWorkPermit = hasWorkPermit;
  this.languages = languages;
  this.pickUpSuitcase = function() {//*object associated function (method) 
    console.log('suitcase is picked up')
  }
  this.move = function() {//*object associated function (method)
    console.log(`${this.name} is on the move`)
  }
  this.moveSuitcase = function() {//*object associated function (method)
    alert("May I take your suticase?");
      this.pickUpSuitcase(); this.move();
  } 
}

//Create New Object From Constructor Using Arguments
var bellBoy1 = new BellBoy('Earl E.Bird', 23, true, ['French', 'German'])

//Access the Properties and Their Values
console.log('Name : ', bellBoy1.name)
console.log('Age : ', bellBoy1.age)
console.log('Verified Work Permit : ', bellBoy1.hasWorkPermit)
console.log('Languages : ', bellBoy1.languages)

//calling the method
bellBoy1.moveSuitcase();
Comment

javascript methods

//The sort() method sorts an array alphabetically:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort();
//output >> [ "Apple",Banana","Mango", "Orange" ]

//if you find the answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript fetch 
Javascript :: template literals 
Javascript :: how to use javascript to hide content and show through link 
Javascript :: why we use mongoose 
Javascript :: react hook form password validation uppercase 
Javascript :: navigation prompt javascript 
Javascript :: for loop on array in javascript 
Javascript :: download file in react 
Javascript :: why bigint js 
Javascript :: how to get json array response in retrofit 
Javascript :: how to add array object in javascript 
Javascript :: react social login buttons 
Javascript :: pure component 
Javascript :: unregister react hook form 
Javascript :: random color generator 
Javascript :: MaterialRippleLayout dependency 
Javascript :: Return a Sorted Array Without Changing the Original Array 
Javascript :: react classname 
Javascript :: console.table in javascript 
Javascript :: mock createRef jest react functional component 
Javascript :: react router dom default params 
Javascript :: how to navigate to another page with settimeout reactjs 
Javascript :: merge two strings with alternate characters javascript 
Javascript :: transformar moeda real javascript 
Javascript :: javascript create date object for midnight for a timezone 
Javascript :: import json file into javascript 
Javascript :: bootstrap 4 form validator with jquery 
Javascript :: column to comma separated string in mongodb 
Javascript :: nodejs get prosses id 
Javascript :: input in html table 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =