Jump to content

copying only the output i want from web console .


hisoka

Recommended Posts

Here is my problem :

for example when I wrote this little piece of code in scratchpad and run it then I got the result in   the web console of Mozilla Firefox  ,

var s = "hello w3schools how are you doing";
var m ;
for(i=0 ; i <s.length ; i++)
  {
   m = s.charCodeAt(i);
   console.log(m);
  }

I got a result of many numbers . Now when I tried to copy the numbers I got in the web console , it did not let me copy only the numbers but other things so that I could not paste only the numbers but the other things too which are not necessary for me . The same happened when I run the code directly in the web console :


 

Quote

 

104
Scratchpad/4:6:4
101
Scratchpad/4:6:4
108
Scratchpad/4:6:4
111
Scratchpad/4:6:4
32
Scratchpad/4:6:4
119
Scratchpad/4:6:4
51
Scratchpad/4:6:4
115
Scratchpad/4:6:4
99
Scratchpad/4:6:4
104
Scratchpad/4:6:4
111
Scratchpad/4:6:4
108
Scratchpad/4:6:4
115
Scratchpad/4:6:4
32
Scratchpad/4:6:4
104
Scratchpad/4:6:4
111
Scratchpad/4:6:4
119
Scratchpad/4:6:4
32
Scratchpad/4:6:4
97
Scratchpad/4:6:4
114
Scratchpad/4:6:4
101
Scratchpad/4:6:4
32
Scratchpad/4:6:4
121
Scratchpad/4:6:4
111
Scratchpad/4:6:4
117
Scratchpad/4:6:4
32
Scratchpad/4:6:4
100
Scratchpad/4:6:4
111
Scratchpad/4:6:4
105
Scratchpad/4:6:4
110
Scratchpad/4:6:4
103

 

 

 

The same happened when I run the code directly in the web console :

Quote

104 debugger eval code:6:4
101 debugger eval code:6:4
108
debugger eval code:6:4
111 debugger eval code:6:4
32 debugger eval code:6:4
119 debugger eval code:6:4
51 debugger eval code:6:4
115 debugger eval code:6:4
99 debugger eval code:6:4
104 debugger eval code:6:4
111
debugger eval code:6:4
108 debugger eval code:6:4
115 debugger eval code:6:4
32 debugger eval code:6:4
104 debugger eval code:6:4
111 debugger eval code:6:4
119 debugger eval code:6:4
32 debugger eval code:6:4
97 debugger eval code:6:4
114 debugger eval code:6:4
101 debugger eval code:6:4
32 debugger eval code:6:4
121 debugger eval code:6:4
111 debugger eval code:6:4
117 debugger eval code:6:4
32 debugger eval code:6:4
100 debugger eval code:6:4
111 debugger eval code:6:4
105 debugger eval code:6:4
110 debugger eval code:6:4
103

 

 

 

I need only to copy paste the numbers from the web console  not with the  Scratchpad.... or debugger eval.... Please could you help me by  showing me how to do it or whether there is a solution to the problem to copy paste numbers without the unnecessary rest .

Edited by hisoka
Link to comment
Share on other sites

If you intend to select and copy the result it might be better to print the result onto the page instead.

var s = "hello w3schools how are you doing";
var output = "";
for(i = 0; i < s.length; i++) {
  output += String(s.charCodeAt(i)) + "<br>";
}
var div = document.createElement("div");
div.innerHTML = output;
document.body.appendChild(div);

 

  • Thanks 1
Link to comment
Share on other sites

Thank you for your reply . But , unfortunately , your answer does not meet my question :)

 

I asked if there is a way or a method  to copy only the numbers from the web console without the  Scratchpad/4:6:4 and debugger eval code:6:4  . So If there is a way or a method  ,  what is it ?

 

best regards

Link to comment
Share on other sites

thank you . Could you please suggest me a Mozilla Firefox  program that runs JavaScript code ,  that is easy to use and far more  flexible and comfortable than the web console , where I can copy paste the content i need without any problem . May be an ad don that I do not know that is compatible with Firefox  58 .  I have Mozilla Firefox 58 and , unfortunately , an add on like , for example ,   Execute JS is not compatible with my version but with the old versions of Firefox

best regards

Edited by hisoka
Link to comment
Share on other sites

If you haven't looked at the Firefox Developer Edition you might want to, although I don't know how much you can customize the console so that it wouldn't tell you the source of the output.  If you only want to copy the output itself then it's best to do what Ingolme suggested.

Link to comment
Share on other sites

thanks , I have another question concerning the web console output :

As you can see , when I run the above code , the output is many numbers each in a line . Is it possible to get , in the web console ,  all numbers in the same line  ? if yes , could you please tell me how ?

 

Link to comment
Share on other sites

Concatenate the values before printing them.

var s = "hello w3schools how are you doing";
var output = "";
for(i = 0; i < s.length; i++) {
  output += String(s.charCodeAt(i)) + " ";
}
console.log(output);

 

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...