Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

JavaScriptの日付操作用ライブラリである「Moment.js」の利用方法を確認します。「Moment.js」は、Dateオブジェクトをラップして、日付操作に関する様々な機能を提供します。豊富な機能が提供されていますが、利用頻度の高い機能について取り上げます。
今月末と来月末の時間を取得する処理を書くときに非常に助かったライブラリ。 https://github.com/kidooom/node_test/blob/master/momentTest.js こんな感じで今日は使った。 var moment = require('moment'); // 今のunixTime console.log(moment().unix()); // 今の日付をformat化して console.log(moment().format("YYYY/MM/DD HH:mm:ss")); // 1ヶ月後 console.log(moment().add('months', 1).format("YYYY/MM/DD HH:mm:ss")); // 15ヶ月後は? console.log(moment().add('months', 15).format("YYY
標準組み込みオブジェクトObjectコンストラクターObject() コンストラクター静的メソッドObject.assign()Object.create()Object.defineProperties()Object.defineProperty()Object.entries()Object.freeze()Object.fromEntries()Object.getOwnPropertyDescriptor()Object.getOwnPropertyDescriptors()Object.getOwnPropertyNames()Object.getOwnPropertySymbols()Object.getPrototypeOf()Object.groupBy()Object.hasOwn()Object.is()Object.isExtensible()Object.isFr
標準組み込みオブジェクトArrayコンストラクターArray() コンストラクター静的メソッドArray.from()Array.fromAsync()Array.isArray()Array.of()静的プロパティArray[Symbol.species]インスタンスメソッドArray.prototype.at()Array.prototype.concat()Array.prototype.copyWithin()Array.prototype.entries()Array.prototype.every()Array.prototype.fill()Array.prototype.filter()Array.prototype.find()Array.prototype.findIndex()Array.prototype.findLast()Array.prototype.find
標準組み込みオブジェクトArrayコンストラクターArray() コンストラクター静的メソッドArray.from()Array.fromAsync()Array.isArray()Array.of()静的プロパティArray[Symbol.species]インスタンスメソッドArray.prototype.at()Array.prototype.concat()Array.prototype.copyWithin()Array.prototype.entries()Array.prototype.every()Array.prototype.fill()Array.prototype.filter()Array.prototype.find()Array.prototype.findIndex()Array.prototype.findLast()Array.prototype.find
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015. Learn moreSee full compatibilityReport feedback some() は Array インスタンスのメソッドで、指定された関数で実装されているテストに、配列の中の少なくとも 1 つの要素が合格するかどうかを判定します。配列の中で指定された関数が true を返す要素を見つけた場合は true を返し、そうでない場合は false を返します。配列は変更しません。
「含むか」の判定処理は様々な方法で実装できます。includes、indexOf、test、match、searchなど利用できます。どれを利用したら良いか考えてみます。 const arr = [40, 30, 20, 10] if (arr.indexOf(20) !== -1) { console.log(arr.indexOf(20)) console.log('存在します') } if (arr.indexOf(50) === -1) { console.log(arr.indexOf(50)) console.log('存在しません') } console.log('----------------------------------------') if (arr.includes(20)) { console.log(arr.includes(20)) console.lo
Is there any way to get the previous URL in JavaScript? Something like this: alert("previous url is: " + window.history.previous.href); Is there something like that? Or should I just store it in a cookie? I only need to know so I can do transitions from the previous URL to the current URL without anchors and all that.
リンク元がお友達のページであれば、「○×さんのホームページからお越しですね。ありがとうございます。」と表示してみたら面白いかもしれません。 リスト <script type="text/javascript"><!-- if (document.referrer.length !=0 ){ myRef = document.referrer; if ( myRef.indexOf( "http://www.google.co.jp" ) == 0 ){ document.write( "Google検索からお越しですね! ありがとうございます!" ); }else if ( myRef == "http://www.red.oit-net.jp/tatsuya/java/index.htm" ){ document.write( "イヌでもわかるJavaScript講座 目次 から いらっ
標準組み込みオブジェクトArrayコンストラクターArray() コンストラクター静的メソッドArray.from()Array.fromAsync()Array.isArray()Array.of()静的プロパティArray[Symbol.species]インスタンスメソッドArray.prototype.at()Array.prototype.concat()Array.prototype.copyWithin()Array.prototype.entries()Array.prototype.every()Array.prototype.fill()Array.prototype.filter()Array.prototype.find()Array.prototype.findIndex()Array.prototype.findLast()Array.prototype.find
標準組み込みオブジェクトArrayコンストラクターArray() コンストラクター静的メソッドArray.from()Array.fromAsync()Array.isArray()Array.of()静的プロパティArray[Symbol.species]インスタンスメソッドArray.prototype.at()Array.prototype.concat()Array.prototype.copyWithin()Array.prototype.entries()Array.prototype.every()Array.prototype.fill()Array.prototype.filter()Array.prototype.find()Array.prototype.findIndex()Array.prototype.findLast()Array.prototype.find
プログラミング初心者向けに、JavaScriptで【setInterval】を使う方法を解説した記事です。本記事では、setIntervalのタイマー処理でカウントアップ、処理を停止する方法を紹介します。 テックアカデミーマガジンは受講者数No.1のプログラミングスクール「テックアカデミー」が運営。初心者向けにプロが解説した記事を公開中。現役エンジニアの方はこちらをご覧ください。 ※ アンケートモニター提供元:GMOリサーチ株式会社 調査期間:2021年8月12日~8月16日 調査対象:2020年8月以降にプログラミングスクールを受講した18~80歳の男女1,000名 調査手法:インターネット調査 JavaScriptをプログラミング初心者向けに紹介した記事です。 今回は、JavaScriptでsetIntervalを使う方法について解説します。 本記事では、テキストエディタのmiを使
This feature is well established and works across many devices and browser versions. It’s been available across browsers since May 2018. Learn moreSee full compatibilityReport feedback export 宣言は、JavaScript モジュールから値をエクスポートするために使用されます。エクスポートされた値は import 宣言やダイナミックインポートによって、他のプログラムにインポートすることができます。インポートされたバインディングの値は、それをエクスポートするモジュールの変更の対象となります。モジュールがエクスポートするバインディングの値を更新すると、その更新はインポートされた値として見えます。 ソースファ
数字、アルファベット、カタカナの全角半角変換は、JavaScriptで簡単に実現できます。今日はその実装方法をブログに書きたいと思います。 目次 全角 → 半角(英数字) function hankaku2Zenkaku(str) { return str.replace(/[A-Za-z0-9]/g, function(s) { return String.fromCharCode(s.charCodeAt(0) - 0xFEE0); }); } // 使用例 hankaku2Zenkaku('123abC'); // '123abC' 文字コード上で、全角英数字から65248引くと半角英数字になります。 また、処理範囲を正規表現で[A-Za-z0-9]と指定していますが、例えば[0-9]とすれば、変換対象を全角数字に限定できます。 半角 → 全角(英数字) function zenka
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く