Last active
January 17, 2018 07:32
-
-
Save Gopikrishna19/84b158cc33ba5a245806444b92ec7fe1 to your computer and use it in GitHub Desktop.
constructors and dynamic binding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function(lang) { | |
const table = initializeTable(lang); | |
return translit(table); | |
} | |
const translit = require('translit')(lang); | |
translit(input) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 => { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@vipranarayan14 ^