This file contains hidden or 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
| interface QueryBuilder { | |
| table(table): QueryBuilder; | |
| select(cols): QueryBuilder; | |
| limit(value: Number): QueryBuilder; | |
| where(col, value): QueryBuilder; | |
| getQuery(): String; | |
| /* +100 Other SQL Methods */ | |
| } |
This file contains hidden or 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
| interface Tablet { | |
| switchOn(); | |
| } | |
| interface Smartphone { | |
| switchOn(); | |
| ring(); | |
| } | |
| class SamsungSmartphone implements Smartphone { |
This file contains hidden or 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
| interface Vehicle { | |
| setMode(mode); | |
| move(); | |
| } | |
| abstract class Delivery { | |
| public abstract makeVehicle(): Vehicle; | |
| public handle() { | |
| const vehicle = this.makeVehicle(); |
This file contains hidden or 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
| interface LanguageInterface { | |
| sayHello(): string; | |
| } | |
| class Persian implements LanguageInterface { | |
| public sayHello(): string { | |
| return 'ุฏุฑูุฏ'; | |
| } | |
| } |
This file contains hidden or 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
| interface Wheel {} | |
| interface Engine {} | |
| class Car { | |
| private wheel: Wheel; | |
| private engine: Engine; | |
| public constructor(wheel: Wheel, engine: Engine) { | |
| this.wheel = wheel; | |
| this.engine = engine; |
This file contains hidden or 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 Queue<T> { | |
| private data: T[] = []; | |
| push(item: T) { | |
| this.data.push(item); | |
| } | |
| pop(): T | undefined { | |
| return this.data.shift(); | |
| } |
This file contains hidden or 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 User { | |
| private rawUsername: string; | |
| get userName(): string { | |
| return "The fullname is: " + this.rawUsername; | |
| } | |
| set userName(newName: string) { | |
| if (newName.length > 10) { | |
| newName = newName.substr(0, 10); |
This file contains hidden or 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 { | |
| name: string; | |
| constructor(name: string) { | |
| this.name = name; | |
| } | |
| sayHello(): string { | |
| return `Hello ${this.name}, Welcome to Ditty.ir`; | |
| } |
This file contains hidden or 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
| let person = { | |
| name: 'Bastian', | |
| lastname: 'Schweinsteiger' | |
| }; | |
| person = JSON.stringify(person); | |
| localStorage.setItem('user', person); | |
This file contains hidden or 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
| // These two lines: | |
| console.log(y); // undefined | |
| y = "Street"; | |
| // are interpreted as: | |
| var y; | |
| console.log(y); // undefined | |
| y = "Street"; |
NewerOlder