Skip to content

Instantly share code, notes, and snippets.

View jonatan-alama's full-sized avatar

Jonatan Alama jonatan-alama

View GitHub Profile
@jonatan-alama
jonatan-alama / checkins_week01.md
Last active April 20, 2018 23:20
checkins_week01

HTML/DOM check

確認目的

  • 簡単なDOM操作
    • getElementById
    • getElementsByClassName
    • querySelector(All)
    • appendChild
import * as React from "react";
import * as ReactDOM from "react-dom";
interface ReactSliderAppState {
value: number;
}
class ReactSliderApp extends React.Component<void, ReactSliderAppState> {
constructor() {
super();
let a = "Hello";
let b = 5;
let c = new Date();
let d = function D() { return true; };
class E {};
let e = new E();
console.log(typeof a); // string
console.log(typeof b); // number
console.log(typeof c); // object
interface IWebsite {
title: string;
url: string;
}
class WebSite {
private _title: string;
private _url: string;
constructor(website: IWebsite) {
this._title = website.title;
let myclass = new MyClass();
if (myclass instanceof IMyInterface) {} // Error "Cannot find name 'IMyInterface'"
if (myclass instanceof MyClass) {} // OK
var MyClass = (function () {
function MyClass() {
}
MyClass.prototype.myMethod = function () {
console.log("myMethod called");
};
return MyClass;
}());
interface IMyInterface {
myValue: string;
myMethod(): void;
}
class MyClass implements IMyInterface {
myValue: string;
myMethod(): void {
console.log("myMethod called");
}
interface IMyInterface {
myValue: string;
myMethod(): void;
}