LoginSignup
0

More than 5 years have passed since last update.

東北, 関東, 中部, 近畿, 中国, 四国, 九州を1つの配列でまとめ、中部を表示

Posted at
<!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>

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