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 :: packages.json from file 
Javascript :: constructor js 
Javascript :: toast js 
Javascript :: concat keys json 
Javascript :: padend javascript 
Javascript :: javascript identifiers 
Javascript :: Image resize using html and javascript 
Javascript :: add class to new element javascript 
Javascript :: discord.js setinterval 
Javascript :: array within array javascript 
Javascript :: react redux form validation 
Javascript :: html call javascript function with input value 
Javascript :: storybook global decorator 
Javascript :: javascript Rename in the import file 
Javascript :: How to display multiple input value in JavaScript 
Javascript :: next js latest 
Javascript :: multiple checkbox validation in javascript 
Javascript :: detect query param route change angular 
Javascript :: How to pass methods in vue js 
Javascript :: LRANGE in redis 
Javascript :: jQuery - AJAX load() Method 
Javascript :: data types in js 
Javascript :: !! js 
Javascript :: concate array to string javascript 
Javascript :: add new html from javascript 
Javascript :: Get Value of JSON As Array 
Javascript :: javascript append array to end of array 
Javascript :: react native basic template 
Javascript :: difference between || and ?? in js 
Javascript :: remove last character from string javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =