#author("2020-06-13T22:41:11+09:00","default:ryuichi","ryuichi")
* 型の比較 - instanceof typeOf [#x69a8182]
#author("2020-06-13T22:41:29+09:00","default:ryuichi","ryuichi")
* 型の比較 - instanceof typeof [#x69a8182]

 class Book {
 }
 
 const book = new Book();
 
 if (book instanceof Book) {
     console.log("OK");
 }
 
 if (typeof book == "object") {
     console.log("OK");
 }
 
 // if (typeof book == "Book") {
 //     console.log("OK");
 // }
 // 
 // typeofはプリミティブ型しか返さない

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS