+ 1
JavaScript Password generator
Can someone please explain how this code work for generating password. Method by method. Math.random().toString(10).slice(2) + Math.random().toString(10).slice(2) );
2 ответов
+ 3
Math.random() generates a random number between 0 and 1. Then you convert it into string:
0.273785732179
//Something like this.
Then with slice, slice the string from the 3rd pos to the end. Making it:
273785732179
+ 3
Then you follow the same process and make another random number.
Then, you combine them both.
And get your password.