LoginSignup
5
5

More than 5 years have passed since last update.

JavaScriptの配列

Last updated at Posted at 2013-11-27

どこかで見かけた配列(文字列の間違いです)処理
この記事は不完全ですので、コメントも合わせてご覧ください


var str = "asdfgh";
var sliceStr = str["slice"](2, 4);

console.log(sliceStr); // df

JavaScriptの 配列 文字列の添え字にString系のプロパティを指定すると同様の処理を行ってくれるようです
全てのStringプロパティで試した訳ではないので例外があるかもしれません

あまり見かけないので、利点は薄いのかもしれませんね

技術的な間違いがございましたらご指摘いただければ幸いです

5
5
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5