Showing posts with label function in javascript. Show all posts
Showing posts with label function in javascript. Show all posts

## number in javascript: -

There are some function which is used as the javascript number function or method and these functions are used to manipulates the number in javascript for exp: - isInteger(),isNaN(),toLocaleString(), toString() in javascript and many more.

 toLocaleString(),toFixed(), toString() in javascript and more number in javascript

The Number.isFinite() method determines whether a worth may be a finite number.

This method returns true if the worth is of the sort Number, and equates to a finite number. Otherwise, it returns false.

Number.isFinite() is different from the global isFinite() function. The global isFinite() function converts the tested value to variety , then tests it.

Number.isFinite() doesn't convert the values to Number, and can not return true for any value that's not of the sort Number.

## syntax : -

`Number.isFinite(value)`
This function returns a boolean value true if the value is a finite Number in javascript or returns false.

## Definition and Usage of isInteger() number in javascript : -

The Number.isInteger() method determines whether a worth an integer.

This method returns true if the worth is of the sort Number, and an integer (a number without decimals). Otherwise, it returns false.

## syntax : -

`Number.isInteger(value)`

## isNaN() Method of number in javascript: -

The Number.isNaN() method determines whether a worth is NaN (Not-A-Number).

This method returns true if the worth is of the sort Number, and equates to NaN. Otherwise, it returns false.

Number.isNaN() is different from the worldwide isNaN() function. the worldwide isNaN() function converts the tested value to variety , then tests it.

Number.isNaN() doesn't convert the values to variety , and can not return true for any value that's not of the sort Number.

## syntax : -

`Number.isNaN(value)`

## Number isSafeInteger() in javascript:-

The Number.isSafeInteger() method determines whether a worth maybe a safe integer.

This method returns true if the worth is of the sort Number and a secure integer. Otherwise, it returns false.

## syntax : -

`Number.isSafeInteger(value)`

## toExponential() Number in javascript:-

The toExponential() method in javascript converts variety into an exponential notation.

## syntax : -

`number.toExponential(x)`

## toFixed() in javascript:-

The toFixed() method in javascript converts variety into a string, rounding to a specified number of decimals.

## syntax : -

`number.toFixed(x)`

Note: if the specified number of decimals is above the particular number, zeros are added to make the specified decimal length.

## JavaScript toLocaleString():-

The toLocaleString() method in javascript converts variety into a string, employing a local language format.

The default language depends on the locale setup on your computer.

## syntax : -

`number.toLocaleString(locales, options)`

Parameter Values for toLocaleString() in javascript: -

ar-SA Arabic (Saudi Arabia)
bn-IN Bangla (India)
cs-CZ Czech (Czech Republic)
da-DK Danish (Denmark)
de-AT Austrian German
de-CH "Swiss" German
de-DE Standard German (as spoken in Germany)
el-GR Modern Greek
en-AU Australian English
en-GB British English
en-IE Irish English
en-IN Indian English
en-NZ New Zealand English
en-US US English
en-ZA English (South Africa)
es-AR Argentine Spanish
es-CL Chilean Spanish
es-CO Colombian Spanish
es-ES Castilian Spanish (as spoken in Central-Northern Spain)
es-MX Mexican Spanish
es-US American Spanish
fi-FI Finnish (Finland)
fr-BE Belgian French
fr-CH "Swiss" French
fr-FR Standard French (especially in France)
he-IL Hebrew (Israel)
hi-IN Hindi (India)
hu-HU Hungarian (Hungary)
id-ID Indonesian (Indonesia)
it-CH "Swiss" Italian
it-IT Standard Italian (as spoken in Italy)
jp-JP Japanese (Japan)
ko-KR Korean (Republic of Korea)
nl-BE Belgian Dutch
nl-NL Standard Dutch (as spoken in The Netherlands)
no-NO Norwegian (Norway)
pl-PL Polish (Poland)
pt-BR Brazilian Portuguese
pt-PT European Portuguese (as written and spoken in Portugal)
ro-RO Romanian (Romania)
ru-RU Russian (Russian Federation)
sk-SK Slovak (Slovakia)
sv-SE Swedish (Sweden)
ta-IN Indian Tamil
ta-LK Sri Lankan Tamil
th-TH Thai (Thailand)
tr-TR Turkish (Turkey)
zh-CN Mainland China, simplified characters

## JavaScript toPrecision() :-

The toPrecision() method in javascript formats variety to a specified length.

A percentage point and nulls are added (if needed), to make the required length.

## syntax : -

`number.toPrecision(x)`

## toString() in JavaScript:-

The toString() function in Javascript is employed with variety and converts the amount to a string. it's wont to return a string representing the required number object.

## syntax : -

`number.toString(radix)`

Optional. Which base to use for representing a numeric value. Must be an integer between 2 and 36.
•  2 - the amount will show as a binary value
•  8 - the amount will show as an octal value
•  16 - the amount will show as a hexadecimal value

## valueof() in JavaScript:-

The valueof() method in JavaScript is employed to return the primitive value of variety.

This method is typically called internally by JavaScript and not explicitly in web code.

## syntax : -

`number.valueOf()`