Day 66

#CodingPhase #TheCodingWay #365CodingPhaseChallenge

**********

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JavaScript Functions</title>

<style type="text/css">
div {position: relative}
h1 {margin: 25px auto; width: 100%; background-color: #E84B0D; text-align: center; font-size: 24px; font-family: sans-serif; color: #FFF}

#leftbutt {width: 100px}
</style>

</head>
<body>
<div>

<h1>More about Functions</h1>
<input type="button" id="button" value="Check age">

<p id="target"></p>

</div>

<script>

/*
true AND false are the boolean data types
*/


function checkAge(age) {

var oldEnough;

if(age > 17) {

oldEnough = true;

} else {

oldEnough = false;

}

return oldEnough;

}

document.getElementById("button").onclick=function(){

console.log(checkAge(12));
}



</script>
</body>
</html>

Comments

Popular posts from this blog

Day 1

Day 365 + 1

Day 365 + 2