Una vez mas, el uso de backtics nos facilita mucho la vida al momento de mostrar un texto que va con variabes!!
¿Este condicional sera de los que mas se usan en programacion??
<script>
const jumpLine = ()=> {
document.write("<br>" * 3);
}
const printPhrase = ()=> {
document.write(phrase);
jumpLine();
}
// recibiendo datos por parametros
let team = prompt("Team name");
let victories = Number(prompt("Number of games won by " + team));
let tied = Number(prompt("Tied matches"));
let pointLastYear = 10;
let teamsWin = (victories * 3) + tied;
document.write("Points achieved this year: " + teamsWin + "<br>");
if (teamsWin==pointLastYear) {
document.write(`El ${team} has the same score as last year`);
} if(teamsWin>pointLastYear) {
document.write(`El ${team} has a higher score than last year`);
} if (teamsWin<pointLastYear){
document.write(`El ${team} has a lower score than last year`);
}
</script>