Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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())
Source by www.toptal.com #
 
PREVIOUS NEXT
Tagged: #fix #broken #class #oop #javascript
ADD COMMENT
Topic
Name
1+3 =