0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

単語をfor文を用いて接続

Posted at

単語をfor文を用いて接続

言語: Javascript
const mySports = ["野球" , "サッカー" ,"テニス"]
let text = "私の好きなスポーツは"
for (let i = 0; i < mySports.length ; i++){
  text += mySports[i]
  if (i !=mySports.length - 1){
    text +=""
  }
}
text += "です。"
console.log(text)

上記のコードで重要な点
・リストの長さを取得するメソッドはリスト.length
・for 文のなかにif文を用いて場合わけする点

0
1
1

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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?