Questions tagged [console.log]

a debugging tool for JavaScript. It is method of the console object which logs the given object in the Browser's JS console.

log method of the console object is a method mainly used for debugging purposes.

Syntax

console.log(obj1 [, obj2, ..., objN]);

Parameters

obj1...objN - A list of JavaScript objects to output. The string representations of each of these objects are appended together in the order listed and output.

Example

Here is a simple JavaScript example which illustrates the use of console.log:

var foo = {'id':7, 'name':'John Doe'};
console.log(foo);

Output (in the console) - {id:7, name:"John Doe"}.

Note - The result my vary depending upon the browser's implementation of console.

Browser Compatibility

This feature is fully-supported on the latest versions of all the major browsers.

  • Mozilla Firefox 4+
  • Microsoft Internet Explorer 8+ (only after opening the F12 developer tools)
  • Google Chrome 1+
  • Opera 10.50+
  • Apple Safari 3+
2040 questions
0
votes
2 answers

Electron handle console.log messages in main process

Is there way to handle console.log messages from renderer in main process? Similar to CefDisplayHandler::OnConsoleMessage handler in Cef.
Evgeny
  • 274
  • 3
  • 8
0
votes
2 answers

Chrome console - reload in loop

I need to check my visitor tracker so I entered this in the chrome console with the setting set to preserve the log: i = 0; while (i<4) { location.reload(); window.alert(i); i++; } The alert box pops pops up 4 times with the values (…
Arjun
  • 199
  • 2
  • 12
0
votes
3 answers

console.log prints undefined

When I try to print a simple string with console.log(), it does not print the string out but rather it returns undefined: > console.log("Hello") < undefined What is wrong?
Prince
  • 245
  • 4
  • 9
0
votes
1 answer

reload button in html

I am trying to reload a button once it is clicked so that it will give more numbers. When I click it once it just gives me the number once in the console…
AltBrian
  • 2,392
  • 9
  • 29
  • 58
0
votes
0 answers

Unable to use OpenLayers library in Browser Debugger Console (React JS)

I am having one application which has OpenLayers Map and implemented using reactjs with OpenLayers library. I am trying to get the latitude and longitude of the map from the browser console in order to use the same in my selenium automation. I am…
Subburaj
  • 2,294
  • 3
  • 20
  • 37
0
votes
1 answer

How to get Access Token from Local Storage in Console using ANGULAR6?

I save the response in local storage in console using angular6. Response contain (Id token, access token , JWT token) I want access token for user authentication. How I get this from local storage using angular.Here is the Access Token
amber gautam
  • 107
  • 2
  • 3
  • 9
0
votes
2 answers

How to debug ajax response?

I am at lost with ways to debug my Ajax callback. I'm trying to print the response from the php file to see if the call is working but without success. While the call works, the response seem to return empty... Nothing shows in the console but the…
Mister Doe
  • 57
  • 1
  • 10
0
votes
1 answer

Where to find backend print outs on staging/production?

Usually when I have backend print outs, I just look in the console that's running npm run dev. That's for local development, but where do I look for console.log() after pushing to staging or production website? I'm using react-redux with express…
HunterLiu
  • 781
  • 3
  • 6
  • 20
0
votes
1 answer

How do I access this response from the console.log?

Usually, it is easier for me to do this with fetch, but this package does not use fetch. I read other questions similar to mine and here is my attempt in trying to do it: SelectPhoto = () =>{ ImagePicker.openPicker({ }).then((imgResponse) =>…
Laney Williams
  • 573
  • 3
  • 13
  • 34
0
votes
1 answer

console.log not showing up when called from a onclick callback [javascript]

Say I have a function like this: var some_value = 0 function refresh(something) { // Log our value console.log(some_value); // If this function was invoked by clicking our some_div created below, set some_value …
Jason Song
  • 21
  • 3
0
votes
2 answers

Printing objects of one value based on another value

I want to console.log a value within an array of objects based on another specific value. For example, I have a simple array of objects. For all of the objects with v: 1, I want to print the z value. var array = [ {v:1, z: 4}, {v:3, z:…
gwydion93
  • 1,681
  • 3
  • 28
  • 59
0
votes
3 answers

How to I fetch values from JSON object without specific key

I have below JSON object from which I want to fetch only certain values on my dev console log using javascript. I tried but below code but I don't know how to loop through array of array. Can anyone please suggest how can i achieve this. var…
Ankit Fulzele
  • 327
  • 5
  • 15
0
votes
1 answer

How to transfer the data from Chrome Browser Console onto C# file

We are getting joint data in JSON Objects format. The data is streaming live on the Chrome Console as you can see in the picture. How do we take this data (from the Chrome Console) and send it over to a C# file on the computer in real-time? …
Jay Tailor
  • 192
  • 1
  • 2
  • 15
0
votes
1 answer

In Wildfly 11, how do I suppress the creation of a console.log file?

I'm using Wildfly 11. I noticed my $WILDFLY_HOME/standalone/log/ directory contains audit.log console.log server.log although console.log and server.log seem to contain similar output. Is there a way to suppress the console.log file from…
Dave
  • 15,639
  • 133
  • 442
  • 830
0
votes
2 answers

Javascript: How can I Choose a specific Part from an Output

easy question: FunctionOutput: Promise { _c: [ { promise: [Object], resolve: [Function], reject: [Function], ok: [Function], fail: [Function], domain: null } ], _a: undefined, _s: 1, _d: true, _v: …
1 2 3
99
100