JavaScript has a built-in function called Number(). It converts the value in parentheses to a number that can be used in calculations. If it is not a number, it will return NaN (Not a Number).
<html>
<head>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<form name="tempForm">
<label for="temp">Temperature:</label>
<input type="text" id="temp"><br>
<input type="radio" name="choice" value="fahrenheit" checked>Convert to Fahrenheit <br>
<input type="radio" name="choice" value="celsius">Convert to Celsius <br>
<label for="resultField">Result: </label>
<input type="text" id="resultField"><br>
<input type="button" value="Convert" onclick="processForm()">
</form>
</body>
</html>
function processForm() {
var temperature = Number(document.tempForm.temp.value);
}