Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

to fix a broken class oop javascript

function PrototypicalGreeting(greeting = "Hello", name = "World") {
  this.greeting = greeting
  this.name = name
}

PrototypicalGreeting.prototype.greet = function() {
  return `${this.greeting}, ${this.name}!`
}

const greetProto = new PrototypicalGreeting("Hey", "folks")
console.log(greetProto.greet())
Comment

to fix a broken class oop javascript

class ClassicalGreeting {
  constructor(greeting = "Hello", name = "World") {
    this.greeting = greeting
    this.name = name
  }

  greet() {
    return `${this.greeting}, ${this.name}!`
  }
}

const classyGreeting = new ClassicalGreeting("Hey", "folks")

console.log(classyGreeting.greet())
Comment

PREVIOUS NEXT
Code Example
Javascript :: boilerplate functional component for DataGrid 
Javascript :: sinalR 
Javascript :: lerp two values 
Javascript :: morgan 
Javascript :: TypeError: (intermediate value).addBooks is not a function in js 
Javascript :: read excel file npm 
Javascript :: javascript get multiple attributes 
Javascript :: bcrypt npm 
Javascript :: leap year list 
Javascript :: three.js animate object regardless screen fps 
Javascript :: phaser remove collider on stop 
Javascript :: jquery attrib 
Javascript :: Vue Js The specified value cannot be parsed, or is out of range 
Javascript :: replace text content with element node 
Javascript :: phaser add camera 
Javascript :: Set Up Model In MongoDB 
Javascript :: cookie in Auth header 
Javascript :: Error: Invalid route module file 
Javascript :: combining not selector with other jquery 
Javascript :: JavaScript HTMLCollection Object 
Javascript :: PostManDocs 
Javascript :: sort items 
Javascript :: Backbone + Express 
Javascript :: how to check if a div tag contains child 
Javascript :: unknown set of argument 
Javascript :: password generator and password strength using javascript 
Javascript :: ampscript remove special character 
Javascript :: .reverse javascript string 
Javascript :: angular cli command to create component without spec 
Javascript :: instance of javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =