うるう年をチェックするJavaScriptプログラム
次の条件が満たされている場合、1年はうるう年です。 年はの倍数です 400。 年はの倍数です 4 の倍数ではありません 100。 例1:if … elseを使用してうるう年を確認する // program t […]
Continue ReadingShare to be Shared!
次の条件が満たされている場合、1年はうるう年です。 年はの倍数です 400。 年はの倍数です 4 の倍数ではありません 100。 例1:if … elseを使用してうるう年を確認する // program t […]
Continue Reading例:日付と時刻を表示する // program to display the date and time // get date and time const date = new Date(2017, 2, 12, 9 […]
Continue Reading例1:正規表現を使用してすべての改行を置き換える // program to replace all line breaks in a string with <br> const string = `I a […]
Continue Reading例1:正規表現を使用して文字のすべてのインスタンスを置き換える // program to replace all instances of a character in a string const string = […]
Continue ReadingBase64 は、バイナリデータを基数64表現に変換することにより、ASCII文字列形式でバイナリデータを表すバイナリからテキストへのエンコードスキームのグループです。 例1:btoa()を使用して文字列をBase64に […]
Continue Reading例1:toUpperCase()の使用 // program to perform case insensitive string comparison const string1 = ‘JavaScript Progr […]
Continue Reading例1:includes()を使用して文字列をチェックする // program to check if a string contains a substring // take input const str = pr […]
Continue Reading例1:JSON.stringify()を使用してオブジェクトを文字列に変換する // program to convert an object to a string const person = { name: ‘Ja […]
Continue Reading例1:文字列をトリミングする // program to trim a string const string = ‘ Hello World ‘; const result = string.trim(); conso […]
Continue Reading例1:startsWith()の使用 // program to check if a string starts with another string const string = ‘hello world’; co […]
Continue Reading