【JavaScript入門】substringメソッドの使い方をわかりやすく解説 文字列の一部だけを取り出したいとき、JavaScriptでは「substring()メソッド」を使います。 この記事では、substring()の基本的な使い方から、引数を省略した場合の動作までを、初心者の方にも分かり ...
substring は文字数を指定するのではなく、開始位置 と終了位置 を指定することで「分割」処理を行います。 今回は開始位置 にマイナスの値を入れてみます。 var str = "文字列"; str.substring("開始位置","終了位置"); 特定の文字列の中で、分割(切り取り)したい ...
Warning: Although String.prototype.substr (…) is not strictly deprecated (as in “removed from the Web standards”), it is considered a legacy function and should be avoided when possible. It is not ...
Most JavaScript developers use objects every day without knowing how they truly work under the hood. ⚙️ When we define a property like obj.name = 'Alex', we assume it's just a simple key-value pair.