0

I'm using JScript to test the character limit of a textbox, and also to make sure that numbers, characters, and special characters are accepted.

If I have an array like ("a", "2", "$", "D"), how can I choose one random value at a time?

I know about Math.round(Math.random()*9), but I don't want to return just an integer.

Thank you.

1 Answer 1

0

Here is what I did:

str = new Array("a", "2", "$", "D");
var result = str[Math.floor(Math.random()*str.length)];
textBox.Keys(result);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.