<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>4_8日本配列</title>
</head>
<body>
<script>
//東北, 関東, 中部, 近畿, 中国, 四国, 九州を1つの配列でまとめ、
//中部を表示
var area = ['東北', '関東', '中部', '近畿', '中国', '四国', '九州'];
console.log(area);
area.push('沖縄'); //沖縄を追加
console.log(area);
area.splice(0,2);//0番目から2個消す
console.log(area);
console.log(area.length);//areaに何個の要素がはいっているか?
for (var i = 0; i < area.length; i++) {
console.log(area[0]);//0番目に中部がはいっているか確認
}
document.write(area[0]);//0番目の中部を表示せよ
</script>
</body>
</html>
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
0