JavaScript Examples

JavaScript is a browser based scripting language. With JavaScript you add behavior to the HTML documents and control the browser or change the HTML document.

The best way to learn JavaScript is to try many examples. JavaScript is also a complex programming language, its not easy to learn JavaScript just because it is a browser language. You must practice lots of examples.

The examples are divided broadly into two categories – Basic Examples and Object-Oriented Examples. The basic example demonstrate the fundamental concepts of JavaScript and Object-Oriented Examples, you learn about Object-Oriented concepts.


The prerequisites for doing JavaScript examples is related to resources you need to get started. Find the list below with a brief description of each.

  • JavaScript tutorial – you must be familiar with JavaScript concepts and the best way to learn is either visit our JavaScript tutorial page or get a good easy to follow JavaScript book with examples.
  • Notepad – to write programs you need  a text editor and browser can interpret the scripts easily. Download a new editor like Bracket, Sublime Text, Notepad++ or use builtin text editors – Notepad or TextEdit in Mac.
  • Browser – you need to install a browser to test you JavaScript code. You can download free browsers from internet like Chrome, Mozilla Firefox, UC Browser, Microsoft Edge, etc.


Books are another source of good examples. If you have the right kind of book then the learning experience is always great.  We recommend you two books that has examples to learn JavaScript. Do read the reviews to before you decide to get them.

amazon javascript2

amazon javascript3

Note: We earn a small commission for every purchase you make.

JavaScript Basic Programs