I program in C++/C/C#/Java but recently started in web programming. I like javascript and i am wondering if one can use it to make desktop program like one would in c++ for creating e.g. console applications...
Or is it only a language that can be used in inside a browser and html?

And php, I read it can also be used as a general purpose language.

My goal is actualy to find a scripting language that works inside webpages and that i can create applications with.

I can recall the option to use HTML5 and Javascript to create Windows 8 Metro app if that's what you're looking for. Other than that I'm not quite sure.

commented: You beat me to it. +7

if usage is concerned than i will recall some points where javascript is used:-

  • Google's Chrome extensions, Opera's extensions, Apple's Safari 5 extensions, Apple's Dashboard Widgets, Microsoft's Gadgets, Yahoo! Widgets, Google Desktop Gadgets, and Serence Klipfolio are implemented using JavaScript.
  • Tools in the Adobe Creative Suite, including Photoshop, Illustrator, Dreamweaver, and InDesign, allow scripting through JavaScript.
  • Many IRC clients, like ChatZilla or XChat, use JavaScript for their scripting abilities.

    Source wiki