ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing

ExpertRating Home
ExpertRating Benefits
Recommend ExpertRating
Suggest More Tests
Privacy Policy
FAQ
Login
 
JavaScript Tutorial - Index
JavaScript Tutorial - Introduction to JavaScript
JavaScript Tutorial - Basic JavaScript Concepts
JavaScript Tutorial - Working with Operators and Variables
JavaScript Tutorial - How to work with Loops and Functions?
JavaScript Tutorial - How to work with Forms and Events?
JavaScript Tutorial - How to work with Objects?
JavaScript Tutorial - How to work with Browsers and Cookies?
JavaScript Tutorial - More about Objects
JavaScript Tutorial - How to validate Forms with JavaScript?
JavaScript Tutorial - Advanced Techniques in JavaScript
     

 
Online Personal Trainer Certification
Personal Trainer Certification (Spanish)
Six Sigma Certification
Find a Personal Trainer
Project Management Certification
Six Sigma Certification
Six Sigma Black Belt Certification
Master Black Belt Certification
Six Sigma Green Belt Certification
Life Coach Certification
Lean Management Certification
Lean Six Sigma Certification
First Aid Certification
CPR Certification
Yoga Certification
Aerobics Certification
Pilates Certification
Business Analyst Certification
SEO Certification
Online Business Writing Course & Certification
Makeup Artist Certification
Baby Sitting Course & Certification
Time Management Certification
Health Club Management Certification
Medical Coding Certification
Medical Billing Certification
Business Analysis Course
Master Trainer Certification
Total Quality Management Certification
Kaizen Certification
Creative Writing Certification
Event Management Certification
Test Search by Job Title
Administrative Assistant Certification
Virtual Assistant Certification
  All Online Courses
   

   
   
   
   
   
   

   
  Home > Courses, Tutorials & eBooks > JavaScript Tutorial > How to work with Objects?
 

JavaScript Tutorial - How to work with Objects?

 
Page 3 of 4
 
String Object

The String object is a built-in object of JavaScript which allows you to manipulate a stored piece of text. The string object provides properties and methods for working with string literal.


Properties of String Object

        Property                                                  Description
length It returns the length of string, i.e., the number of characters in the string is determined (as an integer).
prototype This property is used to add more properties to a string object.

Methods of String Object

         Methods                                                     Description
anchor(anchorName) It displays a string with the specified anchor name as a hypertext anchor.
big( ) It displays a string in large font as within the HTML <BIG></BIG> tags.
blink( ) It displays the string as blinking as within the HTML <BLINK></BLINK> tags.
bold( ) It displays bold characters of string as within HTML <B></B> tags.
charAt(index) It returns a string that contains a character at specified index of the string to which the method is applied.
fixed( ) This method displays a string using a fixed pitch font, as within the teletype HTML tags.
fontcolor(color) The string is displayed in the specified color.
fontsize( ) The string is displayed with a specified font size, size should be within 1 & 7.
indexOf(pattern) This method returns the index of the first occurrence of the specified pattern which is contained in the string or it returns -1, if the pattern is not found in the string.
indexOf(pattern, startIndex) This method also returns the index of the first occurrence of the specified pattern which is contained in the string but the searching starts from a position specified by startIndex or it returns -1, if the pattern is not found.
italics( ) It makes a string to be displayed using the italics HTML tags.
lastIndexOf(pattern) It returns the index of the last string specified by the pattern contained in the string. Returns -1 if the pattern is not contained in the string.
lastIndexOf(pattern, startIndex ) It also returns the index of the last string specified by the pattern contained in the string, but searching begins at a position specified by startIndex.
link( href ) A string is displayed as a hyperlink as specified by the href parameter.
small( ) A string is displayed using using small HTML tags.
split(separator) It splits an array into substrings, based on separator character.
strike( ) Makes a string to appear using the strikeout HTML tags.
sub( ) Makes a string to appear using subscript HTML tags.
substring( startIndex, endIndex) It returns the string starting at the 'start index' of the string and ending at the 'end index' location.
sup( ) Creates a string to appear using superscript HTML tags.
toLowerCase( ) It returns a copy of the string converted into lowercase.
toUpperCase( ) It returns a copy of the string converted into uppercase.

Math Object

Math object is a pre-defined JavaScript object, which allows you to perform various mathematical calculations. There is no need to define the Math object before using it. This object contains constants and methods which can be used in scripts requiring mathematical operations.


Constants of Math Object

         Constant                                                         Description
E Euler's constant, used as the base for natural logarithms (approximately 2.7183)
LN2 It is the natural logarithm with base 2 ( approximately 0.6931)
LN10 It is the natural logarithm for base 10 ( approximately -2.3026)
LOG2E It is the base 2 logarithm of Euler's constant (E) (approximately 1.4427 )
LOG10E It is the base 10 logarithm of Euler's constant ( E )(approximately 0.4343)
PI This constant has value as 22 / 7 ( approximately 3.1416), and is used to calculate the circumference and area of the circle.
SQRT1_2 It is the square root of 1 / 2.(approximately 0.7071)
SQRT2 It is the square root of 2.(approximately 1.14142)

Methods of Math Object

         Method                                                          Description
abs This method calculates the absolute value of a number.
acos This method returns arc cosine of a number in radians between 0 and PI.
asin This method returns arc sine of a number in radians between -PI/2 and PI/2.
atan It returns the arc tangent of a number in radians between -PI/2 and PI/2.
atan2 It returns the polar coordinate angle corresponding to Cartesian x and y coordinates. The value is returned in radians.
ceil It returns the next integer greater than or equal to a number.
cos It returns cosine of a number in radians between 1 and -1.
exp It calculates Euler's constant raised to a power. It is the exponential power.
floor It returns the next integer less than or equal to a number.
log It returns the natural logarithm( Base e) of a number.
max It returns the greater of the two numbers.
min It returns the smaller of two numbers.
pow It calculates the value of one number to the power of a second number.
random It returns a pseudo random number between 0 and 1.
round It returns the integer nearest to a floating point number
sin It calculates the sine of a number between -1 and 1.
sqrt It calculates the square root of a number.
tan It calculates the tangent of a number.

 

       

 

 
     
Home  |  About Us  |  Privacy Policy  |  Site Map  |  FAQs  |  Contact Us
 
© ExpertRating 2015. All Rights Reserved.