console.log

IE 11 - console.log is displaying undefined for object properties

别说谁变了你拦得住时间么 提交于 2019-12-01 16:27:03
问题 This is a pretty short example. I copy and paste the code below into a file, save it, and open it. Works fine in Chrome, fails in ie 11. The output on the console is nonsense! What's going on? Have a stumbled upon some strange bug? test.b is clearly not undefined, as it is accessible by the JSON parser and by direct object evaluation. Also, switching around the order of the variables in the log function does nothing to change test.b being undefined. <!DOCTYPE html> <html> <head> <title>wtf<

Is it possible to render HTML into Javascript console?

走远了吗. 提交于 2019-12-01 00:33:28
I would like to render HTML from a console.(log/info/warn): console.html("<h1>Hello!</h1>"); would render… Hello! …into the console panel. Is it possible somehow? ps.: for the record, I would like to have more coloring options than log/info/warn/error messages. j08691 In a way it's possible using the CSS format specifier . Example: console.log("%cThis will be formatted with large, blue text", "color: blue; font-size: x-large"); The CSS format specifier allows you to customize the display in the console. Start the string with the specifier and give the style you wish to apply as the second

Consecutive calls to console.log produce inconsistent results

早过忘川 提交于 2019-11-30 21:24:36
Ok, I'm completely dumbfounded by this. (and I might be overlooking something obvious but...) I have 2 consecutive calls to console.log. There isn't anything else between them console.log($state); console.log($state.current); and here's an image of the produced results Why do the 2 produce different "current" objects? How can this happen? Context: Those calls are made inside an ajax call while resolving a route dependencies. If you need more code or context let me know. Confirmed the same issue in Chrome and Firefox Ajax call and wrapper function (no modifications whatsoever) normaCtrl

console.log(myFunction()) returns undefined

回眸只為那壹抹淺笑 提交于 2019-11-30 21:10:52
问题 I'm new to JavaScript, and I try to play around with it to understand all in-and-outs. I write function greet() { console.log("Hi"); }; console.log(greet()); And the result of it in the console is > Hi app.js:2 > undefined app.js:4 I assume this is because greet() inside console.log first calls the function, which prints out "Hi" . We get first line of log. But where did the second line come from? Then I thought because Hi is overall result of greet() , then console.log basically calls

Is there a way to read the console.log using Javascript?

回眸只為那壹抹淺笑 提交于 2019-11-30 20:28:44
The title is pretty self-explanatory.. Is there a way to read whatever's been output to the console.log up until the moment you decide to read it, using Javascript? OneOfOne You can make a proxy around it, such as : (function(win){ var ncon = win.console; var con = win.console = { backlog: [] }; for(var k in ncon) { if(typeof ncon[k] === 'function') { con[k] = (function(fn) { return function() { con.backlog.push([new Date(), fn, arguments]); ncon[fn].apply(ncon, arguments); }; })(k); } } })(window); 来源: https://stackoverflow.com/questions/18905393/is-there-a-way-to-read-the-console-log-using

Is it possible to render HTML into Javascript console?

[亡魂溺海] 提交于 2019-11-30 18:52:11
问题 I would like to render HTML from a console.(log/info/warn): console.html("<h1>Hello!</h1>"); would render… Hello! …into the console panel. Is it possible somehow? ps.: for the record, I would like to have more coloring options than log/info/warn/error messages. 回答1: In a way it's possible using the CSS format specifier. Example: console.log("%cThis will be formatted with large, blue text", "color: blue; font-size: x-large"); The CSS format specifier allows you to customize the display in the

Node.js double console.log output

天涯浪子 提交于 2019-11-30 17:41:45
I'm learning Node.js and I'd like to understand the "why" when code spits out duplicated console.log outputs but only a single response.write outputs. Heres my simple code example: var http = require('http'); http.createServer(function(request, response){ response.writeHead(200, {'Content-type': 'text/plain'}); console.log('hello 1'); response.write('Hello world'); console.log('hello 2'); response.end(); }).listen(8000); And on my console/terminal I get: hello 1 hello 2 hello 1 hello 2 Thanks. Some browsers also send a request to locate the favicon.ico file. Since the file isn't present by

Console log in Javascript Office Addin

旧巷老猫 提交于 2019-11-30 12:48:39
I have a question about "console.log" in Javascript Web Office Addins . Currently I am working on Javascript Word Addin and can't troubleshoot it, because I don't understand where the "console.log" output is sent. On Microsoft site there are a lot of examples, that contain contain "console.log", but they never specify how to check these outputs. So, the question is how can I see this "console.log" output. I am not using Visual Studio. BR, Alexey When you say you're not using Visual Studio, do you mean that you're not using the Visual Studio template? Or that you physically don't have Visual

Javascript: Why sometimes alert() does not work but console.log() does?

强颜欢笑 提交于 2019-11-30 08:15:11
From time to time, I face a very intriguing bug. My javascript code does not display an alert(msg) during execution, but if I use a console.log(msg) it does show up in the console. What could prevent alert() from displaying? Thanks a lot This is a very common problem, and everyone has faced this problem atleast once. The reason alert() does not work is because previously you have checked "prevent this page from creating additional dialoug" checkbox. lets take a look at this code. <script type="text/javascript"> var js_name = ['elem1', 'elem2'] for (var i = 0; i < js_name.length; i++) { alert

Is there a way to read the console.log using Javascript?

旧街凉风 提交于 2019-11-30 05:39:51
问题 The title is pretty self-explanatory.. Is there a way to read whatever's been output to the console.log up until the moment you decide to read it, using Javascript? 回答1: You can make a proxy around it, such as : (function(win){ var ncon = win.console; var con = win.console = { backlog: [] }; for(var k in ncon) { if(typeof ncon[k] === 'function') { con[k] = (function(fn) { return function() { con.backlog.push([new Date(), fn, arguments]); ncon[fn].apply(ncon, arguments); }; })(k); } } })