Hola a todos!!
Les envío un cordial saludo y si tienen oportunidad de ver mi código les agradezco mucho..
Saludos!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Using Functions</title>
</head>
<body>
<center><h3>My brother and I.</h3></center>
<script>
/**
* @Creator Emmanuel Montes Lugo.
* @Version 1.0
* @param The next functions are "calculateDiff" and "breakline", the first one is the principal because
* it calculates the difference between the age of my brother and mine. In the second function I am using
* "document.write" for insert a space between lines, and in the last one function, I am using again
* "document.write" for printing some variables and callback to the first function for spacing lines.
*/
function breakLine(){//This is a void function.
document.write("<br><br>");
}
function calculateDiff(brotherAge, myAge){
var result = brotherAge - myAge;
return result;
}
function printSomething(results){
document.write(results);
breakLine();
}
var brotherAge = parseInt(prompt("Put the age of your brother, please: "));
var myAge = parseInt(prompt("My age is: "));
var result = calculateDiff(brotherAge,myAge);
alert("Well done! check the browser to see the results, thanks!")
printSomething("The age of my brother is: " + brotherAge + " years.");
printSomething("My age is: " + myAge + " years.");
printSomething("The result of the difference is: " + result + " years.");
</script>
</body>
</html>