Google Chrome console.log() inconsistency with objects and arrays

After a lot of digging, I found that this has been reported as a bug, fixed in Webkit, but apparently not yet pulled into Google Chrome. As far as I can tell, the issue was originally reported here: https://bugs.webkit.org/show_bug.cgi?id=35801 : Description From mitch kramer 2010-03-05 11:37:45 PST 1) create an object literal with one or … Read more

JavaScript – adding style to the text of console log [duplicate]

Addy Osmani has a good explanation: https://plus.google.com/+AddyOsmani/posts/TanDFKEN9Kn (archive.org) Styled console logging in the Chrome DevTools (Canary) Thanks to Mr. +Mike West, you can now add style to your console log via %c, just like you can in Firebug. e.g console.log(“%cBlue!”, “color: blue;”); Blocks such as console.log(‘%cBlue! %cRed!’, ‘color: blue;’, ‘color: red;’); are also now supported … Read more

Why does console.log say undefined, and then the correct value? [duplicate]

The console will print the result of evaluating an expression. The result of evaluating console.log() is undefined since console.log does not explicitly return something. It has the side effect of printing to the console. You can observe the same behaviour with many expressions: > var x = 1; undefined; A variable declaration does not produce … Read more

Restoring console.log()

Since original console is in window.console object, try restoring window.console from iframe: var i = document.createElement(‘iframe’); i.style.display = ‘none’; document.body.appendChild(i); window.console = i.contentWindow.console; // with Chrome 60+ don’t remove the child node // i.parentNode.removeChild(i); Works for me on Chrome 14.

Printing to the console in Google Apps Script?

The console is not available because the code is running in the cloud, not in your browser. Instead, use the Logger class provided by GAS: Logger.log(playerArray[3]) and then view the results in the IDE under View > Logs… Here’s some documentation on logging with GAS. Edit: 2017-07-20 Apps script now also provides Stackdriver Logging. View … Read more

Dumping whole array: console.log and console.dir output “… NUM more items]”

Setting maxArrayLength There are a few methods all of which require setting maxArrayLength which otherwise defaults to 100. Provide the override as an option to console.dir console.dir(myArry, {‘maxArrayLength’: null}); Set util.inspect.defaultOptions.maxArrayLength = null; which will impact all calls to console.log and util.format Call util.inspect yourself with options. const util = require(‘util’) console.log(util.inspect(array, { maxArrayLength: null … Read more

How can I make console.log show the current state of an object?

I think you’re looking for console.dir(). console.log() doesn’t do what you want because it prints a reference to the object, and by the time you pop it open, it’s changed. console.dir prints a directory of the properties in the object at the time you call it. The JSON idea below is a good one; you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)