I recently started learning Javascript and have been practicing closures. I created a simple code where clicking on a link should increase the font size of the document's body. However, I seem to be making a mistake somewhere and can't figure out what it is.
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: 'Times New Roman', Times, serif;
font-size: 10px;
background-color: bisque;
color:black;
}
</style>
</head>
<body>
<p>HELLO!! I AM CHANGING MY SIZES.</p>
<a href="#" id="size-12" onclick="changeSize(12)">Size 12</a>
<a href="#" id="size-14" onclick="changeSize(14)">Size 14</a>
<a href="#" id="size-16" onclick="changeSize(16)">Size 16</a>
<script>
function changeSize(size) {
return function () {
document.body.style.fontSize = size + 'px';
}
};
</script>
</body>
<html>