「JavaScript」splice()で配列の既存要素を取り除くサンプル

2021年2月19日

構文
let arrDeletedItems = array.splice(start[, deleteCount[, item1[, item2[, …]]]])
取り除かれた要素を含む配列です。
使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
const cft="arkgame";
let res = cft.slice(0,5);
console.log("結果:" + res);
const cft="arkgame"; let res = cft.slice(0,5); console.log("結果:" + res);
const cft="arkgame";
let res = cft.slice(0,5);
console.log("結果:" + res);

実行結果
> “結果:arkga"

JavaScript

Posted by arkgame