0 added
0 removed
Original
2026-01-01
Modified
2026-03-09
1
<p>What should you do if there are two values of different types, and you do not want to rely on the default cast? Use can cast “by hand”.</p>
1
<p>What should you do if there are two values of different types, and you do not want to rely on the default cast? Use can cast “by hand”.</p>
2
<p>For example, you can cast a numeric value to a string type. One way is to use the number.toString() command. For example:</p>
2
<p>For example, you can cast a numeric value to a string type. One way is to use the number.toString() command. For example:</p>
3
var number = 1; // Logs number: 1 (number) console.log(number); // Logs string: "1" (string) console.log(number.toString());
3
var number = 1; // Logs number: 1 (number) console.log(number); // Logs string: "1" (string) console.log(number.toString());