2021-04-04から1日間の記事一覧
オブジェクト オブジェクトの生成は{}で任意のプロパティの組を囲むことで定義する。 オブジェクトの後に「.キー」または「[]」のなかにキーを記載することでプロパティの値にアクセスできる。 また、プロパティの削除はdeleteを使用することで実施できる。 …
typeof演算子を使用すると、型が文字列で出力される。 console.log(typeof "あ"); console.log(typeof 1); console.log(typeof true); 実行結果 $ node test.js string number boolean 参考 typeof - JavaScript | MDN
console.time()とconsole.timeEnd()を併用することで、 この2つに挟まれたプログラムの実行時間を計測することができる。 console.time('timer name') //ここの処理をタイマーで測定 let sum = 0; for(let i = 0; i<10000; i++){ sum += Math.random() } //…