Search notes:

JavaScript: equals operator (==)

<!DOCTYPE html>
<html>
<head>
  <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
  <title>Javascript equals operator ==</title>

  <script type="text/javascript" src="../js-tablator/tablator.js"></script>

  <script type="text/javascript">

    var table_;

    function equals(a, b, comment) {
      eval('result =  ' + a + ' == ' + b)
      table_.addRow(a, '==', b, result, comment);
    }
    
    function main() {

       table_ = new tq84.tablator();

       equals(   '42'       ,      '42' , ''                        );  //  true
       equals(    '0'       ,       '0' , ''                        );  //  true
       equals(   '42'       ,     '"42"', ''                        );  //  true
       equals(   '""'       ,      '"0"', ''                        );  // false
       equals(    '0'       ,       '""', ''                        );  //  true
       equals('"false"'     ,    'false', ''                        );  // false
       equals( 'false'      ,      '"0"', ''                        );  //  true
       equals( 'false'      ,     'null', ''                        );  // false
       equals(  'null'      ,'undefined', ''                        );  //  true
       equals('"\\r\\n\\t"' ,        '0', ''                        );  //  true
       equals('"\\r\\n\\t "',        '0', 'note the spaces'         );  //  true
       equals('"\\r   \\t "',        '0', 'note the spaces'         );  //  true
       equals('"א"'         , '"אָ"'     , 'Niqqud'                  );

       table_.toBody();

    }

  </script>

</head>
<body onload='main()';>
</body>
</html>
Github repository about-javascript, path: /operators/equals.html

See also

Operators

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759413959, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/JavaScript/operators/equals(82): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78