1
respuesta

IMPRIMIR EDADES

Buen día comparto mi código fuente.

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>IMPRIMIR EDADES</title>
</head>
<body>

<h1>IMPRIMIR EDADES</h1>

<script >

    function saltarLinea(){

        document.write("<br><br><br>");
        document.write("<hr>");
        document.write("<br><br>");
    }

    function imprimir(frase){
        document.write("<big>");
        document.write(frase);
        document.write("</big>");
        saltarLinea();
    }

    var anho = 2025;
    imprimir("hola amigos");
    alert("Este código calcula las edades de Juan, Pedro y Carlos");
    // este código calcula las edades de Juan, Pedro y Carlos
    imprimir("Juan tiene: " + (anho-2000) + " años");
    imprimir("Pedro tiene: " + (anho-1995) + " años");
    anho = 2030
    imprimir("Carlos tiene: " + (anho-2005) + " años");

</script>

</body>
</html>
1 respuesta

Muy bien amigo, solo revisa el ultimo string en el browser, hay una faltita ortografica.