I'm trying to get the smallest of 5 numbers from five input boxes.

  • Topic Archived
You're browsing the GameFAQs Message Boards as a guest. Sign Up for free (or Log In if you already have an account) to be able to post messages, change how messages are displayed, and view media in posts.
  1. Boards
  2. Game Design and Programming
  3. I'm trying to get the smallest of 5 numbers from five input boxes.

User Info: LastTomorrow

LastTomorrow
1 month ago#1
function min() {
var a = Trdform.txtwhole1.value;
var b = Trdform.txtwhole2.value;
var c = Trdform.txtwhole3.value;
var d = Trdform.txtwhole4.value;
var e = Trdform.txtwhole5.value;
var min = document.getElementById(small).innerHTML = Math.min()
Frthform.minimum.value = minimum;

Tried this, is there another way.
Waffle waffle waffle

User Info: Amuseum

Amuseum
1 month ago#2
Math.min requires two or more parameters.
Your variable names don't match up. ie 'minimum' is not declared.
Close brackets properly.
Ergonomic keyboard layouts for Android https://goo.gl/KR1vK6
5-suited Draw Poker for Android http://goo.gl/KhmXi

User Info: LastTomorrow

LastTomorrow
1 month ago#3
How would it be set up?
Waffle waffle waffle

User Info: scar the 1

scar the 1
1 month ago#4
Try putting all the variables in a list. Usually, min functions accept collections as arguments, so it'll be able to find the minimum element in a list. But I don't know the language that you're using (Javascript, right), so I don't know how it'd look there.

EDIT: This link is quite helpful:
https://stackoverflow.com/questions/1669190/find-the-min-max-element-of-an-array-in-javascript
So if you put all of your elements in an array called myArray, you could do the following:
Math.min(...myArray);
Everything has an end, except for the sausage. It has two.
  1. Boards
  2. Game Design and Programming
  3. I'm trying to get the smallest of 5 numbers from five input boxes.

Report Message

Terms of Use Violations:

Etiquette Issues:

Notes (optional; required for "Other"):
Add user to Ignore List after reporting

Topic Sticky

You are not allowed to request a sticky.

  • Topic Archived