Programming Tutorials

Built-In JavaScript Objects

By: aathishankaran in Javascript Tutorials on 2007-03-21  

The second set of objects never appears visually, but you work with them within your JavaScript code. You can call them built-in language objects because they are simply constructs of the JavaScript language. Anyone who has worked with any programming language before has worked with the following types of objects:

String Object

The string object represents a value you assign to a variable of an object property. JavaScript treats both assigned variables and string literals as string objects.

Array Object

The array object is an object representation of the traditional programming construct. An array is an ordered set of data elements, and every index number in an array contains a value. You can have as many indexes in the array as you want.

Arrays are powerful and your JavaScript scripts can use them in a variety of ways. The following code segment shows a simple example.

  <SCRIPT LANGUAGE="JavaScript">
    theJs = new Array(3)
    theJs[l] = "Jordan"
    theJs[2] = "Jared"
    theJs[3] = "Justin"
    document.write("<H1>The three Js are:</H1>")
    for (var i = 1; i < 4; i++) {
      document.write("<LI>" + theJs[i])

Math Object

The math object is used for standard mathematical calculations. Rather than using generic math functions in JavaScript, these functions are implemented as methods of the math object. Suppose you wanted to evaluate two numbers that the user entered.

Add Comment

* Required information


No comments yet. Be the first!

Most Viewed Articles (in Javascript )

Latest Articles (in Javascript)