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 :: add google map in react js 
Javascript :: queryselector j 
Javascript :: localstorage in next js 
Javascript :: react native icons 
Javascript :: vuejs 
Javascript :: javascript array map 
Javascript :: javascript extract array from object 
Javascript :: asp net core use newtonsoft json 
Javascript :: vue js laravel tutorial 
Javascript :: ternary operator in javascript 
Javascript :: in javascript pass infinite argument in function 
Javascript :: change url without reloading the page 
Javascript :: play sound onload react 
Javascript :: gitea 
Javascript :: type conversion in javascript 
Javascript :: javascript remove an element from an array 
Javascript :: autofocus is not working in react native 
Javascript :: ilan mask 
Javascript :: converter rgba to hex without opacity 
Javascript :: javascript save multiple images to server 
Javascript :: how to add animation over image in Javascript 
Javascript :: how to add space between words in javascript 
Javascript :: how to add a function in javascript 
Javascript :: how to create variables using javascript 
Javascript :: insertar al inicio de un array javascript 
Javascript :: even numbers in an array 
Javascript :: Get home directory in nodejs windows 
Javascript :: Beep sound Javascript 
Javascript :: javascript round big numbers 
Javascript :: print name time times in javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =