Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
5 added 14 characters in body
source | link

Javascript, 155 148 134 115115 101 bytes

Not very short, but:

l=Arrayl=[.from..Array({length:50},x=>Math)].floormap(Mathx=>Math.random()*256)*256|0).sort((a,b)=>b-a);console.log(l);f=x=>l.findIndex(v=>x>v)

Returns position when higher than at least one score. Otherwise -1.

Edit: apparently you don't have to output scores line by line. So shorter now.

l=Arrayl=[.from..Array({length:50},x=>Math)].floormap(Mathx=>Math.random()*256)*256|0).sort((a,b)=>b-a);console.log(l);f=x=>l.findIndex(v=>x>v)

console.log(f(200))
console.log(f(60))
console.log(f(30))
console.log(f(2))

14 bytes saved by @Downgoat

Javascript, 155 148 134 115 bytes

Not very short, but:

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);console.log(l);f=x=>l.findIndex(v=>x>v)

Returns position when higher than at least one score. Otherwise -1.

Edit: apparently you don't have to output scores line by line. So shorter now.

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);console.log(l);f=x=>l.findIndex(v=>x>v)

console.log(f(200))
console.log(f(60))
console.log(f(30))
console.log(f(2))

Javascript, 155 148 134 115 101 bytes

Not very short, but:

l=[...Array(50)].map(x=>Math.random()*256|0).sort((a,b)=>b-a);console.log(l);f=x=>l.findIndex(v=>x>v)

Returns position when higher than at least one score. Otherwise -1.

Edit: apparently you don't have to output scores line by line. So shorter now.

l=[...Array(50)].map(x=>Math.random()*256|0).sort((a,b)=>b-a);console.log(l);f=x=>l.findIndex(v=>x>v)

console.log(f(200))
console.log(f(60))
console.log(f(30))
console.log(f(2))

14 bytes saved by @Downgoat

4 added 21 characters in body
source | link

Javascript, 155 148 134134 115 bytes

Not very short, but:

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);console.log(l);f=x=>l.some((v,i)=>x>v?console.logfindIndex(i)||1:0v=>x>v)

Returns position and true when higher than at least one score. Otherwise false-1.

Edit: apparently you don't have to output scores line by line. So shorter now.

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);console.log(l);f=x=>l.some((v,i)=>x>v?console.logfindIndex(i)||1:0v=>x>v)

console.log(f(200))
console.log(f(60))
console.log(f(30))
console.log(f(2))

Javascript, 155 148 134 bytes

Not very short, but:

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);console.log(l);f=x=>l.some((v,i)=>x>v?console.log(i)||1:0)

Returns position and true when higher than at least one score. Otherwise false.

Edit: apparently you don't have to output scores line by line. So shorter now.

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);console.log(l);f=x=>l.some((v,i)=>x>v?console.log(i)||1:0)

console.log(f(200))
console.log(f(60))
console.log(f(30))
console.log(f(2))

Javascript, 155 148 134 115 bytes

Not very short, but:

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);console.log(l);f=x=>l.findIndex(v=>x>v)

Returns position when higher than at least one score. Otherwise -1.

Edit: apparently you don't have to output scores line by line. So shorter now.

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);console.log(l);f=x=>l.findIndex(v=>x>v)

console.log(f(200))
console.log(f(60))
console.log(f(30))
console.log(f(2))

3 deleted 3 characters in body
source | link

Javascript, 155 148148 134 bytes

Not very short, but:

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);l.forEach(x=>console;console.log(x)l);f=x=>l.some((v,i)=>x>v?console.log(i)||1:0)

Returns position and true when higher than at least one score. Otherwise false.

Edit: apparently you don't have to output scores line by line. So shorter now.

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);l.forEach(x=>console;console.log(x)l);f=x=>l.some((v,i)=>x>v?console.log(i)||1:0)

console.log(f(200))
console.log(f(60))
console.log(f(30))
console.log(f(2))

Javascript, 155 148 bytes

Not very short, but:

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);l.forEach(x=>console.log(x));f=x=>l.some((v,i)=>x>v?console.log(i)||1:0)

Returns position and true when higher than at least one score. Otherwise false.

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);l.forEach(x=>console.log(x));f=x=>l.some((v,i)=>x>v?console.log(i)||1:0)

console.log(f(200))
console.log(f(60))
console.log(f(30))
console.log(f(2))

Javascript, 155 148 134 bytes

Not very short, but:

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);console.log(l);f=x=>l.some((v,i)=>x>v?console.log(i)||1:0)

Returns position and true when higher than at least one score. Otherwise false.

Edit: apparently you don't have to output scores line by line. So shorter now.

l=Array.from({length:50},x=>Math.floor(Math.random()*256)).sort((a,b)=>b-a);console.log(l);f=x=>l.some((v,i)=>x>v?console.log(i)||1:0)

console.log(f(200))
console.log(f(60))
console.log(f(30))
console.log(f(2))

2 deleted 3 characters in body
source | link
1
source | link