index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My JavaScript</title>
</head>
<body>
<script src="main.js"></script>
</body>
</html>
main.js
'use strict';
{
const scores = [70, 90, 80, 85];
scores.splice(2, 0, 77, 88);
// [70, 90, 77, 88, 80, 85]
const deleted = scores.splice(3, 1);
// [70, 90, 77, 80, 85]
// [88]
scores.splice(2, 2, 30);
// [70, 90, 30, 85]
console.log(scores);
console.log(deleted);
}