If condition with === - Javascript Statement

Javascript examples for Statement:if

Description

If condition with ===

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from w  ww. j  a va2  s  .com
var x = document.getElementById("test");
var text = 'There are No friends posts yet my   love!!';
console.log(x.innerText == '')
if(x.innerText === ''){
    x.innerText = text;
}
    }

      </script> 
   </head> 
   <body> 
      <div id="test"> 
      </div>  
   </body>
</html>

Related Tutorials