<!DOCTYPE html>
<html lang="en-US">
<body>
<p>Click the button to return the position where the newline character was found in a string.</p>
<button onclick="myFunction()">Click me</button>
<p id="point"></p>
<script>
function myFunction(){
var str = "His style Is \nWho is he IS";
var pattern = /\n/;
var result = str.search(pattern);
document.getElementById("point").innerHTML = result;
}
</script> </body>
</html>