+ 7

challenge-- length of random number

var randm = Math.floor(Math.random()*100)+1; o/p : numbers between 1 &100; i wanted to know the number of digits in O/P using JAVASCRIPT. Ex ,if output is 5 : digit 1 if output is 20 :digit 2 o/p: output

6th Mar 2018, 11:23 AM
Msaligs
Msaligs - avatar
3 Antworten
+ 6
hmmmmm? Um challenge....accepted and digit of 0 is 0 right? also What is O/P? 😓 Ah Maybe you want to show the better way than mine right? if yes that such a spectacular thing of you! :D https://code.sololearn.com/WY1fCYyjf3xR/?ref=app
6th Mar 2018, 12:08 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 6
you can submit this challenge via lesson factory , as an assignment.
6th Mar 2018, 12:58 PM
Vukan
Vukan - avatar
+ 5
var random=Math.floor(Math.random()*100)+1; var r=random; random=String(random); var digit=random.length; alert(r+" : "+digit+' digits') //easy challenge //btw does o/p means output
6th Mar 2018, 12:39 PM
Prashanth Kumar
Prashanth Kumar - avatar