Search notes:

JavaScript: printf in the console

The console.log() method has some basic printf functionality: (%s for strings, %d for integers, %f for floats (doubles?))
<html>
<head>
  <meta charset="utf8">

<title>console.log</title>

<script type="text/JavaScript">

  function main() {

    var str = 'foo bar baz';
    var i   =  42;
    var flt =  Math.PI;

    console.log('str: %s', str);
    console.log('i  : %s', i  );
    console.log('flt: %f', flt);

//  var obj = {x: 'eggs', y: 'why', z: {num: 42, question: '?'}};
//  console.log('obj: %o', obj);
//  console.log('obj: %O', obj);

  }

</script>
</head>
<body onload='main()'>

</body>
</html>
Github repository Browser-Object-Model, path: /console/printf.html

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...', 1759331268, '216.73.216.88', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/web/browser/object-model/console/printf(65): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78