Finished part 1-4#5
Conversation
| var x= Math.floor(Math.random() * 10) + 1 | ||
| while(true) | ||
| { | ||
| if(x == y) |
There was a problem hiding this comment.
I like that you thought of giving the user a chance to re-try the guessing part here.
It works, although a tip for improving this bit - the variable y is undeclared at line 87 the first time this runs. In stricter languages or other flavours of Javascript, this can throw an error. Next, this loop throws an alert for "Try again" even before the user has the chance to make his first guess.... why?
| var y=prompt("Enter the ength of a random alphanumeric string"); | ||
| var length= parseInt(y); | ||
| var z=Math.random().toString(36).substring(length); | ||
| alert(z); |
There was a problem hiding this comment.
Good trick to convert a random float into a base 36 string. But the length of the substrings returned are incorrect...
| } | ||
| testArray=shuffle(testArray); | ||
| console.log(testArray); | ||
| */ |
There was a problem hiding this comment.
Try to use more descriptive variable names as a matter of good coding practice. Code readability is important when working in teams, and any increase in file size is completely negated by pre-production compilers/optimizers.
No description provided.