0
0

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 5 years have passed since last update.

JavaScriptで電車賃計算

Posted at

電車賃計算をJavaScriptを使って答えを出したいのですが(else if)がうまくいかず難航してます。
[ HTML ]
carbon (4).png
[ JavaScript ]
carbon (3).png

・ifでselectから取得した値が同じならばMapから電車賃を取得してresultへ出力
・値が違っていれば(else if)で、Mapから別の値を取得

という動きをさせたいのですが毎回一番最後に書いた(else if)が反映されます。

どこのコードが間違っているのかわからず悩んでおります。
ご助言いただけたらと思います。
よろしくお願いします。

0
0
0

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?