Edit This Code:
<!DOCTYPE html>
<html>
<body>

<p id="myP" style="font-style:italic;">This is a paragraph.</p>

<button type="button" onclick="myFunction()">Return font style</button>
 
<script>
function myFunction() {
    alert(document.getElementById("myP").style.fontStyle);
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com