Let's dive into a challenging scenario for those who consider themselves experts in JavaScript, particularly with switch and if statements. Here is how it typically works:
var a = 1;
if (a == 1) alert("true");
This is just a basic example. Now, let's see how it is supposed to work with the switch statement:
var a = 1;
switch (a)
{
case 1: alert("true");
}
However, when attempting to use the switch statement to replace multiple if statements, things don't seem to go as planned. This issue has been discussed before, but each code snippet varies, leaving me unable to find a consistent solution online.
The following code should indicate that the hero's values are NOT confirmed:
<script type="text/javascript">
// Your script here...
</script>
Your hero:
<select id="heroes">
{/* Options */}
</select>
<br />
Your skill level: <input type="text" id="SkillQ"><br />
Required skill level: <input type="text" id="SkillA"><br />
<label for="writeNew">Write New?</label><input type="checkbox" id="writeNew" /><br />
<button onclick="skillcalc()">Calculate</button>
<p id="Answer"></p>
Feel free to ask any questions about this intriguing challenge. There may be something I'm missing, but I'm eager to figure it out.
Sincerely, Patrick