javaScript core objects properties - methods

javascript array object properties methods

arrays store ordered lists of data. data is stored at indices enumerated beginning with zero, which are accessed using the array access [] operator. allocation of array memory is handled by the interpreter.

JavaScript array object properties

propertydescriptiob
lengthsets or returns the number of elements in an array
prototypeallows you to add properties and methods to an array object

JavaScript array object methods

methoddescriptiob
concat()joins two or more arrays, and returns a copy of the joined arrays
join()joins all elements of an array into a string
reverse()reverses the order of an elements in an array.
sort()sorts the elements of an array
indexof()returns the index of the first occurrence of a value in an array.
lastindexof()returns the index of the last occurrence of a specified value in an array.
push()adds new elements to end of an array and returns the new length.
pop()removes the last element from an array and returns that element.
shift()removes the first element from an array and returns that element
unshift()adds new elements to the front of an array and returns the new length
slice()extracts a section of an array and returns a new array
splice()addsremoves elements from an array
tostring()converts an array to a string, and returns the result
valueof()returns the primitive value of an array

strings are useful for holding data that can be represented in text form.the string literal value enclosed in single(') or double(") quotes.

syntax:

         var   str = "this is the ram" ;

JavaScript string object properties

propertydescription
constructorreturns the function that created the string object's prototype
lengthreturns the length of a string
prototypeallows you to add properties and methods to an object

JavaScript string object methods

propertydescription
charat()returns the characters at the specified index
charCodeAt()returns the unicode of the character at the specified index
fromCharCode()converts unicode values to characters
concat()combines the text of two strings and returns a new string
contains()determines whether one string may be found within another string
indexOf()returns the position of the first found occurrence of a specified value in a string
lastIndexOf()returns the position of the last found occurrence of a specified value in a string
match()used to match a regular expression against a string
replace()replace the matched substring with a new substring
search()executes the search for a match between a regular expression and a specified string
slice()extracts a section of a string and returns a new string
split()splits a string object into an array of strings by separating the string into substring
substring()returns the characters in a string between two indexes into the string
toLowerCase()returns the calling string value converted to lower case.
toUpperCase()returns the calling string value converted to upper case.
trim()removes the leading and trailing white space characters from a string
valueOf()returns the primitive value of the specified object.

JavaScript Date Object Properties and Methods

the javascript date object provides uniform behavior across platforms.

the date objects are created with the date() constructor.

syntax:

         var  date = new  Date()
propertydescription
constructorreturns the function that created the date objects prototype.
prototypeallows you to add properties and methods to an object

JavaScript date object methods

propertydescription
getYear()returns the year
getFullYear()returns the year(four digits)
getMonth()returns the month(from 0 - 11)
getDay()returns the day of the week (from 0 to 6)
getDate()returns the day-of-the-month value using local time.(from 0 - 31)
getHours()returns the hour (from 0 to 23)
getMinutes()returns the minutes (from 0 - 59)
getSeconds()returns the seconds (from 0 - 59)
getMillisecond()returns the milliseconds (from 0 - 999)
getTime()returns the number of milliseconds since midnight jan 1, 1990
getTimezoneOffset()returns the time difference in minutes between the time on the host computer and (utc)
getutcFullYear()returns the year according to universal time(four digits)
getutcMonth()returns the month according to universal time(from 0 - 11)
getutcDay()returns the day of the week according to the universal time(from 0 to 6)
getutcDate()returns the day-of-the-month value according to universal time.(from 0 - 31)
getutcHours()returns the hour according to universal time(from 0 to 23)
getutcMinutes()returns the minutes according to universal time(from 0 - 59)
getutcSeconds()returns the seconds according to universal time(from 0 - 59)
getutcMillisecond()returns the milliseconds according to universal time(from 0 - 999)
setFullYear()sets the year of a date object
setMonth()sets the month of a date object
setDate()sets the day-of-month of a date object
setHours()sets the hour of a date object
setMinutes()sets the minutes of a date object
setSeconds()sets the seconds of a date object
setMilliseconds()sets the milliseconds of a date object
setutcFullYear()sets the year of a date object according to universal time
setutcMonth()sets the month of a date object, according to universal time
setutcDate()sets the day-of-month of a date object, according to universal time
setutcHours()sets the hour of a date object, according to universal time
setutcMinutes()sets the minutes of a date object, according to universal time
setutcSeconds()sets the seconds of a date object, according to universal time
setutcMilliseconds()sets the milliseconds of a date object, according to universal time
toDateString()returns a date as a string value
togmtstring()returns a date converted to a string using greenwhich mean time(gmt)
toisostring()returns a date as a string value in iso format.
tojsonused to transform data of an object type before the json serialization
toLocaleDateString()returns a date as a string value appropriate to the host environment's current locale
toLocaleString()returns an object converted to a string using the current locale.
toLocaleTimeString()returns the time portion of a date object as a string, using locale conventions
toString()converts a date object to a string
toutcstring()converts a date object to a string, according to universal time
toTimeString()converts the time portion of a date object to a stirng
toutc()returns the number of milliseconds in a date string since midnight of january 1, 1970,according (utc)
valueOf()returns the primitive value of the specified object.

javascript regExp object

regular expression is an object that describes a pattern of characters.

Regular expressions are used to perform pattern-matching and "search-and-replace" functions on text.

syntax:

         var  pattern   =   /pattern/flag ;

or

         var  pattern   =   new   RegExp(pattern, flags) ;

regExp object properties

propertydescription
globalspecifies if the 'g' flag is set
ignoreCasespecifies if the 'i' flag is set
multilinespecifies if the 'm' flag is set
indexinteger value indicating the character position where the first successful match begin
lastIndexreturns the character position where the next match begins in a searched string
lastMatchreturns the last matched characters from any regular expre search.read-only
sourcethe text of the regexp pattern

JavaScript regExp object methods

propertydescription
compile()compiles a regular expression
exec()tests for a match in a string. returns the first match
test()tests for a match in a string. returns the true or false
toString()converts a RegExp object to a string, and returns the result