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

【JavaScript編】paizaの問題集を解いてみた

Posted at

最近、JavaScriptを勉強し始めました。
paizaのレベルアップメニューのコードは公開自由とのことでしたので、勉強の記録として投稿します。

今回挑戦したのは、Cランクレベルアップメニューの「辞書」より「STEP: 1 辞書の基本」。
問題を掲載して良いかはわかりませんので、気になる方は下記よりご確認頂けたらと思います。
https://paiza.jp/works/mondai/c_rank_level_up_problems/c_rank_dictionary_step1?language_uid=javascript

const fs = require("fs");
const inputs = fs.readFileSync("/dev/stdin", "utf-8").trim().split("\n");
const num = Number(inputs[0]);
const searchName = inputs[num+1];


for (let i = 1; i <= num; i++) {
    [personalName, property] = inputs[i].split(" ");
    if (personalName === searchName) console.log(property);
}

もっと良い書き方があると思いますので、アドバイス等頂けましたら嬉しいです。

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?