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
| // concept of Body, its characteractics are sense, spirit and ego | |
| class Body { | |
| private sense = new Sense(); | |
| private spirit = new Spirit(); | |
| private ego = new Ego(); | |
| // assume a person is weak in willing | |
| private hasStrongWill = false; | |
| public experience(input): Will { |
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
| var Actor = function () { | |
| this._lastName = 'Tom'; | |
| this._firstName = 'Hanks'; | |
| } | |
| Actor.prototype.getFullName = function () { | |
| return this._lastName + ' ' + this._firstName | |
| } | |
| var actor = new Actor(); | |
| var greeting = function (getFullNameFunc) { |
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
| var Actor = function () { | |
| this._lastName = 'Tom'; | |
| this._firstName = 'Hanks'; | |
| } | |
| Actor.prototype.getFullName = function () { | |
| return this._lastName + ' ' + this._firstName | |
| } | |
| var actor = new Actor(); | |
| var greeting = function (getFullNameFunc) { |
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
| var Actor = function () { | |
| this._lastName = 'Tom'; | |
| this._firstName = 'Hanks'; | |
| } | |
| Actor.prototype.getFullName = function () { | |
| return this._lastName + ' ' + this._firstName | |
| } | |
| var actor = new Actor(); | |
| var greeting = function (getFullNameFunc) { |
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
| import * as fs from 'fs'; | |
| async function longRunJsFunction(count) { | |
| let y = 0; | |
| for (let i = 0; i < count; i++) { | |
| } | |
| console.log('longRunJsFunction finished'); | |
| return 1; | |
| } |
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
| import { Person } from "./personAbstractClass"; | |
| class Student extends Person { | |
| constructor( | |
| firstName: string, | |
| lastName: string, | |
| private _studentId: number | |
| ) { | |
| super(firstName, lastName); | |
| } |
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
| export class abstract Person { | |
| constructor( | |
| protected _firstName: string, | |
| protected _lastName: string | |
| ) { | |
| } | |
| } |
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
| export class ClassA { | |
| constructor(private _fullName: string) { | |
| } | |
| public Greeting(): void { | |
| const fullName = this.getFullName(); | |
| console.log(`Hello ${fullName}!`); | |
| } | |
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
| import { ClassA } from "../classA"; | |
| import { suite, test, slow, timeout } from "mocha-typescript"; | |
| import { assert } from "chai"; | |
| @suite("ClassA test suite") | |
| class ClassASuite extends ClassA { | |
| constructor() { | |
| super("Tom Hanks"); | |
| } |