0
0

More than 1 year has passed since last update.

javascript演習 11日目/30日

Posted at

覚えたこと

splice()とslice()の違い

・spliceメソッドを使うと元になった配列要素が変更されてしまう
 sliceメソッドは元の配列を変更しない
・slice()は文字列型のメソッド

arr.slice([start[, end]])
splice(start, deleteCount)

配列の最後から一定数文字を取得して、
配列をつなげて、特定の文字が含まれてるかどうか調べる

arr.splice(-secretCode.length -1  , pressed.length - secretCode.length);
if(arr.join('').includes(secretCode)){
}
0
0
0

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
0
0