Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Plunker, How to access variable from the browser console

Tags:

I'm using Plunker (http://plnkr.co/) to test JavaScript. From the browser console I want to access variables that I defined in the script.

In Plunker, can anyone tell me how to access the variable "someValue" from the browser console.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <script type="text/javascript">
      var someValue = 3
      console.log(someValue);
    </script>
</body>
</html>
like image 449
Mike Barlow - BarDev Avatar asked Jul 16 '13 00:07

Mike Barlow - BarDev


People also ask

How do I access the Plunker console?

Any console. logs in javascript are displayed in HTML - Plunker. var consoleArray = []; var serverlogconfig = { "debug": false, "error": true, "info": true, "warn": true, "log": true }; var createLogger = function(o,m) { console.

How do I use the console log in browser?

Console Logs in Chrome: In Google Chrome, the Console Logs are available as a part of Chrome Dev Tools. To open the dedicated Console panel, either: Press Ctrl + Shift + J (Windows / Linux) or Cmd + Opt + J (Mac).

How do I use JavaScript developer console in my browser?

To open the developer console in Google Chrome, open the Chrome Menu in the upper-right-hand corner of the browser window and select More Tools > Developer Tools. You can also use Option + ⌘ + J (on macOS), or Shift + CTRL + J (on Windows/Linux).


3 Answers

I figured out one possible solution. In Google Chrome's Developer Tools on the bottom of the developer console "top frame" can be changed to "run.plnkr.co" (see image below). This will change the scope of the console and the variables in the script can now be accessed.

Plunker in Google Chrome

Here's the answer for jsFiddle: Access variables in jsFiddle from Javascript console?

like image 50
Mike Barlow - BarDev Avatar answered Oct 07 '22 19:10

Mike Barlow - BarDev


or you can use http://jsbin.com/ which displays the console directly

like image 35
Nadir Avatar answered Oct 07 '22 19:10

Nadir


using a separate window helped me debug the scopes and everything.

just follow as below, and then use F12

expand to a seperate window

like image 40
DL Narasimhan Avatar answered Oct 07 '22 17:10

DL Narasimhan