admin管理员组

文章数量:1421000

Is there way to track the value of a certain variable with chrome debugger while it's running?

I'm debugging a javascript code which contains some variables related to sound. I think these variables are changed every second. I want to track those values, if it's possible. There are four of them. One is the download of the mp3 file itself (I think it's called streaming). The other one is the progress of the playing, and I'm not sure about the rest.

There is a swf file that plays music and the control of it is shown through javascript.

Thanks.

Is there way to track the value of a certain variable with chrome debugger while it's running?

I'm debugging a javascript code which contains some variables related to sound. I think these variables are changed every second. I want to track those values, if it's possible. There are four of them. One is the download of the mp3 file itself (I think it's called streaming). The other one is the progress of the playing, and I'm not sure about the rest.

There is a swf file that plays music and the control of it is shown through javascript.

Thanks.

Share Improve this question edited Apr 26, 2018 at 6:44 vestland 61.5k41 gold badges218 silver badges339 bronze badges asked Jul 5, 2013 at 22:38 user2495207user2495207 8612 gold badges10 silver badges16 bronze badges 2
  • Do you mean PHP variables, JavaScript variables, or ActionScript variables? This question is rather ambiguous. – Trump Voters Deserve Damnation Commented Jul 5, 2013 at 22:51
  • They're ActionScript variables passed to JavaScript variables, I don't know anything about that swf file – user2495207 Commented Jul 6, 2013 at 15:03
Add a ment  | 

4 Answers 4

Reset to default 2

You can use watch expressions in the debugger.

Javascript

console.log(someVariable);

AS3

trace(someVariable);

PHP

echo $someVariable;

C

scanf("%s", &someVariable);
printf("%s",someVariable);

C++

getline(cin, someVariable);
cout << someVariable;

Java

Scanner scanner = new Scanner(System.in);
String someVariable = scanner.getLine();
System.out.println(someVariable);

Python

someVariable = input('Enter some variable: ')
print(someVariable)

If you want to see variables in the console check out Firephp.

If you are referring to JavaScript variables, then yes, it is possible. Chrome has excellent debugging tools. Try opening the "scripts" tab, finding the section of code you wish to debug, and click on a line number. This will set a break point for that section of code. When that breakpoint is reached, you will see a bunch of information on the right, including the call stack and scope variables. It is here you can track the value of your variables. Another option might be to simply add a console.log(yourVariable) to your script and use the console to see what it's value is throughout the execution of your code.

本文标签: phpHow to track variable39s value with chrome debugger tools while it39s runningStack Overflow