ใช้เมธอด bold() ของ String ทำให้ข้อความตัวหนา เหมือนแท็ก <b>
ตัวอย่าง
<html>
<head>
<title>JavaScript String bold() Method</title>
</head>
<body>
<script>
var str = new String("Demo Text");
document.write(str.bold());
alert(str.bold());
</script>
</body>
</html>
ผลลัพธ์
<b>Demo Text</b>
⚠️ Legacy method – ใช้ CSS font-weight: bold; หรือแท็ก <strong> (semantic) / <b> (visual) ใน HTML
vs
<strong>– semantic: สำคัญ/เน้น (screen readers เน้นเสียง)<b>– visual: แค่ตัวหนา ไม่มีความหมายพิเศษ