How do you make this work? find min or max b/w 2 entered values


#1

Hi there,
So this is my code
HTML

            <div style = "margin-left:20px;" >
				<select style = "width:100px;color:#0000ff;">
					<option>*Choose*</option>
					<option>Find Min</option>
					<option>Find Max</option>
				</select>
				<input type = "text" name = "int1" placeholder = "Enter the first Number"> █
				<input type = "text" name = "in2" placeholder = "Enter second Number">
				<input type = "button" name = "Run" value = "Run it!" onclick = "eval()">
			</div>

Javascript

function eval(){
		
	}

I want to make a function that decides on the chosen option, what to find.. and then when finding out what they chose. it should find that which will either be Minimum or maximum of the two entered values!

:smiley:


#2

How do you expect help with this? You haven't written any JS code yet. What is the struggle?


#3

struggle is I'm new to javascript, So I don't know how to even start this exercise... all I was told is to give options between min or max, and then decide which of the two values added are to be displayed based on the option chosen.


#4

Maybe learn some more JS? as for what you need, here are two helpful MDN doc page:

and a useful stackoverflow question: