2
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?

「デデンネする」をJavaScriptでコードゴルフ

Last updated at Posted at 2024-01-12

元ネタ

ルール

  • デ:50%, ン:25%, ネ:25% の割合でランダムな文字列を生成する。
  • 末尾がデデンネになったら生成を止め、文字列を表示する。

コード

67文字

for(t='';!t.match(d='デデンネ');)t+=d[Math.random()*4|0];console.log(t)
読みやすく加工
for (t = ''; !t.match(d = 'デデンネ');) {
    t += d[Math.random() * 4 | 0];
}
console.log(t);
2
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
2
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?