selfish log

勉強メモ

2020-01-01から1年間の記事一覧

JavaScript - disabledプロパティ - ボタンの有効/無効を切り替える

const start = document.getElementById('start'); const stop = document.getElementById('stop'); const reset = document.getElementById('reset'); start.disabled = false; stop.disabled = true; reset.disabled = true; 表示 button要素のdisabledプ…

JavaScript - 月の日数を調べる

カレンダーのプログラムを書くときに、各月の日数をどうやって調べればよいのかというメモ。 const today = new Date(); const year = today.getFullYear(); const month = today.getMonth(); const lastDate = new Date(year, month + 1, 0).getDate(); ポ…

スプレッド構文-リストの中に別リストの要素を展開した状態で追加したい。

2つのリストがあり、一方をもう一方のリストに続くように、入れたい。 const a = [10, 20, 30]; const b = [40, 50, 60]; const c = [a,b]; // [[10, 20, 30],[40, 50, 60]] こうしてしまうと、リストの中にリストが入った状態になってしまうので、ここでス…