<!
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Convert Number to String</title>
</head>
<body>
<h1>Number to String Conversion Methods</h1>
<script>
let num = 123;
// 1. Using String() function
let str1 = String(num);
console.log("Using String():", str1, typeof str1);
// 2. Using .toString() method
let str2 = num.toString();
console.log("Using .toString():", str2, typeof str2);
// 3. Using Template Literals
let str3 = `${num}`;
console.log("Using Template Literals:", str3, typeof str3);
// 4. Using String Concatenation
let str4 = num + "";
console.log("Using String Concatenation:", str4, typeof str4);
// 5. Using JSON.stringify()
let str5 = JSON.stringify(num);
console.log("Using JSON.stringify():", str5, typeof str5);
</script>
</body>
</html>