IT
SMA
この写真にある二つのプログラミングがわかりません。どなたか教えてください。
市町村の郵便番号 (町名)の数を求めるfunction を作成してください。
kadai12-1.html
<meta charset="utf-8"/>
<script src="saitama.js"></script>
</pre>
<script>
function getCount(cityName){
}
document.writeln(getCount("さいたま市西区 "));
document.writeln(getCount("さいたま市北区));
document.writeln(getCount("川越市"));
</script>
</pre>
function 名: getCount
仮引数 : cityName
実行結果例
// → 32
// → 16
//→ 164
市町村名
※課題補足
for of 文を使用してもOK
while文を使用してもOK
使用する変数名は自由
配列pointsのデータから、以下の出力をしてください。
連想配列の配列 points
出力結果
let points = [
};
{id: "A", point: 20},
{id: "A", point: 30},
{id: "A", point: 50},
7
{id: "B", point: 10},
{id: "B", point: 60},
{id: "B", point: 70},
{id: "C", point: 50},
{id: "C", point: 30},
※ idプロパティの値は昇順に並んでいる
A→B→C
※要素は1つ以上存在する
A: 20
A: 30
A: 50
TOTAL: 100
B:10
B: 60
B: 70
|TOTAL: 140
C: 50
C: 30
TOTAL: 80
[プログラムの条件]
・繰返し構文を使用する (for, while, for of)
・要素の値や要素数が変わっても対応のこと
・使用する変数や変数名は自由
Answers
No answer yet
Apa kebingunganmu sudah terpecahkan?
Pengguna yang melihat pertanyaan ini
juga melihat pertanyaan-pertanyaan ini 😉