JSFiddle - React, Tailwind, and code Playground

by Neal

JavaScript

var weight = parseInt(prompt("What is your weight?"));
if (weight > 126) {
    alert('Please enter a weight lighter than 126');
}
document.writeln('<br/>');
var wArray = ["fly", "superfly", "bantam", "superbantam", "feather"];

function recruit() {
    if (0 < weight < 112) {
        document.writeln('You are in' + wArray[0] + 'class!');
    }
    if (112 < weight < 115) {
        alert('You are in' + wArray[1] + 'class!');
    }
    if (weight > 115 && weight < 118) {
        alert('You are in' + wArray[2] + 'class!');
    }
    if (weight > 118 && weight < 122) {
        alert('You are in' + wArray[3] + 'class!');
    }
    if (weight > 122 && weight < 126) {
        alert('Your weight class is' + wArray[4]);
    }
}

recruit();