LoginSignup
1
0

「デデンネする」を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);
1
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
1
0