function to change paragraph style on button click
<!DOCTYPE html>
<html><head>
<meta charset=utf-8 />
<title>JS DOM paragraph style</title>
</head>
<body>
<p id ='text'>JavaScript Exercises - w3resource</p>
<div>
<button id="jsstyle"
onclick="js_style()">Style</button>
</div>
<script>
function js_style(){
let p = document.getElementById("text");
p.style.color = "red";
}
</script>
</body>
</html>