= 13.563;
console.log(`number: ${a}\ntype: ${typeof(a)}`);
}
main();
\\ number: 13.563
\\ type: number
yes but what if we first converted it to a string using toFixed, can we retrieve decimals after that?
Do you mean you want to convert a stringified float to a number? If so, then yes. function main() { a = "13.563"; a = parseFloat(a); console.log(`number: ${a}\ntype: ${typeof(a)}`); } main(); \\ number: 13.563 \\ type: number
function main() { a = "13.00"; a = parseFloat(a); console.log(number: ${a}\ntype: ${typeof(a)}); } main(); \\ number: 13 \\ type: number yes but now it removed the decimal parts I want to if there is a way that it returns 13.00 instead of 13 with type number of course
read this please
I'm afraid this is not possible in any programming language as a matter of fact.
thanks for your time anyway.
typeof is an operator
It’s possible in angular using datepipe
Обсуждают сегодня