In this article, I’ll list all of the built in functions available to you with Javascript. While not everything will be covered, I will cover every function that is used on a regular basis. I’m still deciding whether I’ll cover Javascript Graphics or AJAX next. Leave comments below to help me understand. On to the functions.
Javascript Array Functions
In previous articles I described how to create Arrays, but if you forgot here is how you create arrays:
- var a = new array() // Creates an empty array
- var b = new array(8) // Creates an array with 8 element cells
- var c = [1, 2, “turtle”, “number”, true]; // Creates an array with a bunch of random values
Javascript Array Properties and Functions
- b.length // A property that would return the value of 8, because of the array declaration above
- c.concat(3,4) // The array c now has the values 1, 2, “turtle”, “number”, true, 3, 4
- c.join(“: “) // Returns a string with each element separated by a colon and a space. 1: 2: number: true
- c.slice(0, 2) // Returns an array which contains all elements between the first value you pass to the second value. In this example you would be returned [1, 2, number]
- c.sort() // Returns the array elements in alphabetical order. This example returns [1, 2, number, true, turtle]
- c.toString() // Converts the array into a string and then returns the string.
Continue reading Javascript Scripting Tutorial: Built in Functions