Home | | Web Technology | Built –In Objects - JavaScript (JS)

Chapter: Web Technology : JavaScript (JS)

Built –In Objects - JavaScript (JS)

For a complete reference of all the properties and methods that can be used with the Date object, go to our complete Date object reference.

BUILT –IN OBJECTS

 

Java Script String

 

The String object is used to manipulate a stored piece of text.

 

Complete String Object Reference

 

For a complete reference of all the properties and methods that can be used with the String object, go to our complete String object reference.

The reference contains a brief description and examples of use for each property and method!

 

String object

 

The String object is used to manipulate a stored piece of text.

 

Examples of use:

 

The following example uses the length property of the String object to find the length of a string: var txt="Hello world!";

document.write(txt.length);

The code above will result in the following output:

12

 

JavaScript Date Object

 

The Date object is used to work with dates and times.

 

Complete Date Object Reference

 

For a complete reference of all the properties and methods that can be used with the Date object, go to our complete Date object reference.The reference contains a brief description and examples of use for each property and method!

 

Create a Date Object

 

The Date object is used to work with dates and times. Date objects are created with the Date() constructor.

 

Set Dates

 

We can easily manipulate the date by using the methods available for the Date object.

 

Complete Boolean Object Reference

 

For a complete reference of all the properties and methods that can be used with the Boolean object, go to our complete Boolean object reference.The reference contains a brief description and examples of use for each property and method!

 

Create a Boolean Object

 

The Boolean object represents two values: "true" or "false".The following code creates a Boolean object called myBoolean:

 

var myBoolean=new Boolean();

 

JavaScript Math Object

 

The Math object allows you to perform mathematical tasks.

 

Complete Math Object Reference

 

For a complete reference of all the properties and methods that can be used with the Math object, go to our complete Math object reference.The reference contains a brief description and examples of use for each property and method!

 

Math Object

 

The Math object allows you to perform mathematical tasks.The Math object includes several mathematical constants and methods.

 

Syntax for using properties/methods of

Math: var pi_value=Math.PI;

var sqrt_value=Math.sqrt(16);

 

Mathematical Constants

 

JavaScript provides eight mathematical constants that can be accessed from the Math object. These are: E, PI, square root of 2, square root of 1/2, natural log of 2, natural log of 10, base-2 log of E, and base-10 log of E.

 

Mathematical Methods

 

In addition to the mathematical constants that can be accessed from the Math object there are also several methods available.The following example uses the round() method of the Math object to round a number to the nearest integer:

 

document.write(Math.round(4.7)); The code above will result in the following output: 5

 

JavaScript RegExp Object

RegExp, is short for regular expression.

 

Complete RegExp Object Reference

 

For a complete reference of all the properties and methods that can be used with the RegExp object, go to our complete RegExp object reference.The reference contains a brief description and examples of use for each property and method!

 

What is RegExp?

 

A regular expression is an object that describes a pattern of characters.When you search in a text, you can use a pattern to describe what you are searching for.A simple pattern can be one single character.A more complicated pattern can consist of more characters, and can be used for parsing, format checking, substitution and more.Regular expressions are used to perform powerful pattern-matching and "search-and-replace" functions on text.

 

Syntax

var txt=new RegExp(pattern,modifiers);

 

or more simply:

 

var txt=/pattern/modifiers;

 

pattern specifies the pattern of an expression

modifiers specify if a search should be global, case-sensitive, etc.

 

RegExp Modifiers

 

Modifiers are used to perform case-insensitive and global searches.The i modifier is used to perform case-insensitive matching.The g modifier is used to perform a global match (find all matches rather than stopping after the first match).

 

JAVASCRIPT

DEBUGGERS Firebug

 

Firebug is a powerful extension for Firefox that has many development and debugging tools including JavaScript debugger and profiler.

 

Debugging Methods

 

Debugging in Javascript doesn't differ very much from debugging in most other programming languages. See the article at Computer programming/debugging.

 

Browser Bugs

 

Sometimes the browser is buggy, not your script. This means you must find a workaround.


Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Web Technology : JavaScript (JS) : Built –In Objects - JavaScript (JS) |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.