Слышал, читал, что eval = evil. Как мне его заменить в данном примере, чтобы возвращалось последнее значение?
Пример:
plnkr.co/edit/XzEFLbDw6bjtyu74hHSx?p=preview<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<form name="quizForm" onsubmit="return submitAnswers()">
<h3>1. In which HTML element do we put in Javascript code?</h3>
<input type="radio" name="q1" value="a" id ='q1a' > a. < js > <br>
<input type="radio" name="q1" value="b" id ='q1a' > b. < script > <br>
<input type="radio" name="q1" value="c" id ='q1a' > c. < body > <br>
<input type="radio" name="q1" value="d" id ='q1a' > d. < link > <br>
<h3>2. In which HTML element do we put in Javascript code?</h3>
<input type="radio" name="q2" value="a" id ='q2a' > a. < js > <br>
<input type="radio" name="q2" value="b" id ='q2b' > b. < script > <br>
<input type="radio" name="q2" value="c" id ='q2c' > c. < body > <br>
<input type="radio" name="q2" value="d" id ='q2d' > d. < link > <br >
<h4>3. In which HTML element do we put in Javascript code?</h4>
<input type="radio" name="q3" value="a" id ='q3a' > a. < js > <br>
<input type="radio" name="q3" value="b" id ='q3b' > b. < script > <br>
<input type="radio" name="q3" value="c" id ='q3c' > c. < body > <br>
<input type="radio" name="q3" value="d" id ='q3d' > d. < link > <br>
<br>
<input type="submit" value="Submit Answers">
</form>
</body>
</html>