xxxxxxxxxx
let num = 5;
let str = String(num)
// str = '5'
xxxxxxxxxx
let x = 14;
document.getElementById("demo").innerHTML =
x.toString() + "<br>" +
(14).toString() + "<br>" +
(100 + 14).toString();
xxxxxxxxxx
String(x) // returns a string from a number variable x
String(123) // returns a string from a number literal 123
String(100 + 23) // returns a string from a number from an expression
xxxxxxxxxx
let num1 = 52;
let num2 = num1 + '';
console.log(typeof (num2))
//Expected outpur: string
xxxxxxxxxx
#include<stdio.h>
#include <math.h>
int main()
{
char str[80];
sprintf(str, "The value of PI = %f", M_PI);
puts(str);
return 0;
}