// 1. Number.parseFloat()
(async () => {
let { input } = require("jsshort");
let strFloat = await input("Enter a floating-point number: ");
console.log(Number.parseFloat(strFloat));
})();👍2
// 2. Number.parseInt()
(async () => {
let { input } = require("jsshort");
let strInt = await input("Enter an integer: ");
let radix = parseInt((await input("Enter the radix (optional): ")) || 10);
console.log(Number.parseInt(strInt, radix));
})();// 3. Number.isNaN()
(async () => {
let { input } = require("jsshort");
let value = parseFloat(await input("Enter a value to check for NaN: "));
console.log(Number.isNaN(value));
})();// 4. Number.isFinite()
(async () => {
let { input } = require("jsshort");
let num = parseFloat(await input("Enter a number to check if it's finite: "));
console.log(Number.isFinite(num));
})();// 5. Number.isInteger()
(async () => {
let { input } = require("jsshort");
let num = parseFloat(await input("Enter a number to check if it's an integer: "));
console.log(Number.isInteger(num));
})();// 6. Number.isSafeInteger()
(async () => {
let { input } = require("jsshort");
let num = parseFloat(await input("Enter a number to check if it's a safe integer: "));
console.log(Number.isSafeInteger(num));
})();// 7. Number.MAX_SAFE_INTEGER
console.log(Number.MAX_SAFE_INTEGER);
// 8. Number.MIN_SAFE_INTEGER
console.log(Number.MIN_SAFE_INTEGER);
// 12. Number.POSITIVE_INFINITY
console.log(Number.POSITIVE_INFINITY);
// 13. Number.NEGATIVE_INFINITY
console.log(Number.NEGATIVE_INFINITY);
// 14. Number.prototype.toFixed()
(async () => {
let { input } = require("jsshort");
let num = parseFloat(await input("Enter a number: "));
let precision = parseInt(await input("Enter the number of decimal places: "));
console.log(num.toFixed(precision));
})();// 15. Number.prototype.toPrecision()
(async () => {
let { input } = require("jsshort");
let num = parseFloat(await input("Enter a number: "));
let precision = parseInt(await input("Enter the precision value: "));
console.log(num.toPrecision(precision));
})();// 16. Number.prototype.toString()
(async () => {
let { input } = require("jsshort");
let num = parseFloat(await input("Enter a number: "));
let radix = parseInt(await input("Enter the radix (optional): "));
console.log(num.toString(radix));
})();// 17. Number.prototype.valueOf()
(async () => {
let { input } = require("jsshort");
let num = parseFloat(await input("Enter a number: "));
console.log(num.valueOf());
})();// 18. Number.prototype.toLocaleString()
(async () => {
let { input } = require("jsshort");
let num = parseFloat(await input("Enter a number: "));
let locales = await input("Enter locales (optional): ");
let options = { style: 'currency', currency: 'USD' };
console.log(num.toLocaleString(locales, options));
})();Index:
Loops: https://t.me/nodejs_codes_pro/120
Lists ( Array ): https://t.me/nodejs_codes_pro/123
Strings: https://t.me/nodejs_codes_pro/148
Objects: https://t.me/nodejs_codes_pro/172
Numbers: https://t.me/nodejs_codes_pro/202
Why not joined coding channels and practice groups 👇
https://t.me/addlist/2UhsQW_cGzkxMzg1
Loops: https://t.me/nodejs_codes_pro/120
Lists ( Array ): https://t.me/nodejs_codes_pro/123
Strings: https://t.me/nodejs_codes_pro/148
Objects: https://t.me/nodejs_codes_pro/172
Numbers: https://t.me/nodejs_codes_pro/202
Why not joined coding channels and practice groups 👇
https://t.me/addlist/2UhsQW_cGzkxMzg1
🔥1😁1
Now it's discussion group is public you can ask any questions or discuss at any topic
@Nodejs_group_pro
Hindi / English
@Nodejs_group_pro
Hindi / English