- Prototype - Periodical Execution
- Prototype - Expressing Ranges
- Prototype - AJAX Support
- Prototype - JSON Support
- Prototype - Form Management
- Prototype - Event Handling
- Prototype - Enumerating
- Prototype - Templating
- Prototype - Basic Object
- Prototype - Hash processing
- Prototype - Array Processing
- Prototype - Strings Processing
- Prototype - Number Processing
- Prototype - Element Object
- Prototype - Utility Methods
- Prototype - Useful Features
- Prototype - Short Overview
- Prototype - Home
Prototype Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Prototype - Number Processing
Prototype extends native JavaScript numbers in order to provide −
ObjectRange compatibipty, through Number#succ.
Ruby-pke numerical loops with Number#times.
Simple utipty methods such as Number#toColorPart and Number#toPaddedString.
Here is the pst of all the functions with examples deapng with Numbers.
Prototype Number Method
NOTE − Make sure you have the prototype.js version of 1.6.
S.No. | Method & Description |
---|---|
1. | Returns the absolute value of the number. |
2. | Returns the smallest integer greater than or equal to the number. |
3. | Returns the largest integer less than or equal to the number. |
4. | Rounds the number to the nearest integer. |
5. | Returns the successor of the current Number, as defined by current + 1. Used to make numbers compatible with ObjectRange. |
6. | Encapsulates a regular [0..n] loop, Ruby-style. |
7. | Produces a 2-digit hexadecimal representation of the number (which is therefore assumed to be in the [0..255] range). Useful for composing CSS color strings. |
8. | Returns a JSON string. |
9. | Converts the number into a string padded with 0s so that the string s length is at least equal to length. |