Javascript Node Js basic to Advance
1.09K subscribers
4 photos
1 video
2 files
39 links
Javascript Node Js group

@LogicB_Support
@BCA_MCA_BTECH
Download Telegram
// 11. Number.MAX_VALUE
console.log(Number.MAX_VALUE);
// 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));
})();
Numbers methods 👆
Now it's discussion group is public you can ask any questions or discuss at any topic

@Nodejs_group_pro

Hindi / English
// fibonacci series by js

function fibonacci(num) {

if (num == 1)
return 0;

if (num == 2)
return 1;

let num1 = 0;
let num2 = 1;
let sum;
let i = 2;

while (i < num) {
sum = num1 + num2;
num1 = num2;
num2 = sum;
i += 1;
}

return num2;
}


console.log("Fibonacci(5): " + fibonacci(5));

console.log("Fibonacci(8): " + fibonacci(8));
👍1
// currySum
function sum(a, b, c) {
return a + b + c;
}

let curry = fn => (a => (b => (c => fn(a, b, c))));

let currySum = curry(sum);
console.log(currySum(1)(2)(3));
👍1👎1
Everything related to coding 👇
https://t.me/addlist/2UhsQW_cGzkxMzg1
👍2
Apna khud ka Compiler bot run karna ab bahut simple hai

Bas iocompiler lib install karo aur code run kardo 👇ye dekho poori details

https://t.me/logicBots/207
// Api to fetch states of india

const statesURL = 'https://cdn-api.co-vin.in/api/v2/admin/location/states';

require("axios").get(statesURL)
.then(response => {
const states = response.data.states;
console.log('States:', states);
})
.catch(error => {
console.error('Error fetching states:', error.message);
});
// Api to fetch district of states of india

// at last 34 is up state's id to fetch district of up

const statesURL = 'https://cdn-api.co-vin.in/api/v2/admin/location/districts/34';

require("axios").get(statesURL)
.then(response => {
const states = response.data.states;
console.log('States:', states);
})
.catch(error => {
console.error('Error fetching states:', error.message);
});