Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System.out.println equivalent?

 
Herbert Kornfeld
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can you do what is an equivalent of System.out.println in Javascript in order to debug?
Many Thanks
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alert("my debug text");
 
sunitha reghu
Ranch Hand
Posts: 937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use alert(" system testing");
 
Paul McKenna
Ugly Redneck
Ranch Hand
Posts: 1006
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to write it on the page you would use
document.write("Your Text");
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

to write it on the page you would use document.write("Your Text");

This technique is only useful in on-page script that executes while the page is loading. After the page is laoded, this will not do what you want!
bear
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic