Skip to content

Instantly share code, notes, and snippets.

@Gopikrishna19
Last active January 17, 2018 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gopikrishna19/84b158cc33ba5a245806444b92ec7fe1 to your computer and use it in GitHub Desktop.
Save Gopikrishna19/84b158cc33ba5a245806444b92ec7fe1 to your computer and use it in GitHub Desktop.
constructors and dynamic binding
export default function(lang) {
const table = initializeTable(lang);
return translit(table);
}
const translit = require('translit')(lang);
translit(input)
class Person{
constructor(name, age) {
this.name = name;
this.age = age;
}
sayHello() {
console.log(`Hello, ${this.name}! you are in grade ${this.grade}`);
}
}
const p = new Person('gopi', 26);
console.log(p);
p.sayHello();
function Person(name, age) {
this.name = name;
this.age = age;
}
Person.prototype.sayHello = function() {
console.log(`Hello, ${this.name}! you are in grade ${this.grade}`);
}
const p = new Person('gopi', 26);
console.log(p);
p.sayHello();
function Student(name, age, grade) {
Person.call(this, name, age);
this.grade = grade;
}
Student.prototype = Object.create(Person.prototype);
const s = new Student('gopi', 26, 4);
console.log(s);
s.sayHello();
class Student extends Person {
constructor(name, age, grade) {
super(name, age);
this.grade = grade;
}
}
const s = new Student('gopi', 26, 4);
console.log(s);
s.sayHello();
const translit = table => input => {
}
@Gopikrishna19
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment