If condition with === - Javascript Statement

Javascript examples for Statement:if


If condition with ===

Demo Code

ResultView the demo in separate window

      <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;

      <div id="test"> 

Related Tutorials