Pin Me

What is JavaScript?

written by: Aunindita•edited by: Amber Neely•updated: 9/18/2010

Even if you're brand new to programming, you've probably heard of JavaScript. This scripting language is becoming more and more popular with developers when producing interactive web sites. Read on to find out more about this programming language and what it is used for.

  • slide 1 of 4

    JavaScript Basics

    Computer You may be asking the question, "What is JavaScript?" Basically, JavaScript is a scripting language that is used by web developers to add dynamic, interactive content to a web page.

    Although JavaScript may sound similar in name to Java, the two languages are quite different. For instance, while many consider JavaScript to be a simpler language, it can not produce standalone applications. However, almost all of the latest versions of modern browsers have built-in JavaScript support, so you can embed JavaScript code into an HTML page without requiring viewers to download any additional tools to view the page in most cases.

    Image Credit:

  • slide 2 of 4

    What Are the Benefits of JavaScript?

    • JavaScript uses simple language that can be understood by both technical and normal users.
    • You can select what you want to put on your webpage and the locations using JavaScript. The freedom and manipulation is up to you.
    • Visual displays will be further improved by JavaScript.
    • JavaScript offers simple icons and tools to support printing, scrolling and editing, etc.
    • JavaScript allows you to create a simple navigation system.
    • You can make your webpage interactive – and more enticing to viewers – using JavaScript.
    • JavaScript offers a fast feedback system to users.
  • slide 3 of 4

    Using JavaScript

    calculator JavaScript will activate automatically within the web browser, assuming that JavaScript has been enabled. The viewer must have a web browser that is compatible with JavaScript to ensure that the code runs correctly, allowing them to read and use the web site.

    You can use Javascript for simple functions like inserting the date or adding a calculator, or you can even use it for more complex tasks like making games.

    Image Credit:

  • slide 4 of 4

    Writing JavaScript Code

    Even if you're completely new to programming and know very little about JavaScript, you can still add JavaScript code to your web pages fairly effortlessly. Since it is a text-based language, you don't need any special tools or applications to create the code – in fact, Notepad works just fine. However, you still may want to consider using an IDE to help avoid typos and syntax errors.

    In addition, there are many snippets of JavaScript code that have been written by other programmers that you can freely download and use on your site. In this case, all you have to do is cut and paste! Before doing so, you should check with the creator of the code to make sure that there are no restrictions on its usage. For instance, see Open a Second Window on a Web Page with a JavaScript Window Command to see easy it is to use JavaScript to perform this task.

    Another more in-depth example can be found in Use JavaScript to Pick Daily Lottery Numbers. This guide shows how to create a function in JavaScript and use it to select random numbers. Also, you can find additional information on JavaScript commands and their usage in our JavaScript topic area here in Bright Hub's Web Development Channel.