Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. function Preposition(name_init) {
  2. this.name = name_init;
  3.  
  4. this.displayName = function() {
  5. console.log(`Preposition is ${this.name}`);
  6. }
  7. }
  8.  
  9. let these = new Preposition("these");
  10. these.displayName(); // Prints Preposition is these
  11. let those = new Preposition("those");
  12. those.displayName(); // Prints Preposition is those
  13.  
  14. these.displayName.call(those); // // Prints:- Preposition is those
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement