Check out example codes for "w3school". It will help you in understanding the concepts better.

Code Example 1

<!DOCTYPE html>
<html>
<body>

<p>Please input a number between 
5 and 10:</p>

<input id="demo" type="text">
<button type="button" 
onclick="myFunction()">Test Input</button>
<p id="p01"></p>


<script>
function myFunction() {
  var message, x;
  message = 
document.getElementById("p01");
  message.innerHTML = "";

  x = 
document.getElementById("demo").value;
  
try { 
    if(x == "") throw "empty";

      
 if(isNaN(x)) throw "not a number";
    
 x = Number(x);
    if(x < 5) throw 
 "too low";
    if(x > 10) throw "too 
 high";
  }
  catch(err) {
    message.innerHTML = 
"Input is " + err;
  }
}
</script>

</body>
</html>

Code Example 2

MDN vs W3S: Civil War!

Code Example 3

<!DOCTYPE html>

<html>

<title>HTML Tutorial</title>

<body>


<h1>This is a heading</h1>

<p>This is a paragraph.</p>


</body>

</html>

Code Example 4

<!DOCTYPE html>

<html>

<title>HTML Tutorial</title>

<body>


<h1>This is a heading</h1>

<p>This is a paragraph.</p>


</body>

</html>

Learn ReactJs, React Native from akashmittal.com