The symbol.description property in JavaScript converts a Symbol object to a primitive value. The syntax is as follows −
Symbol()[Symbol.toPrimitive](hint);
Example
<!DOCTYPE html>
<html>
<body>
<h2>Demo Heading</h2>
<p>Click to display...</p>
<button onclick="display()">Result</button>
<p id="test"></p>
<script>
function display() {
const val = Symbol('john');
console.log(val[Symbol.toPrimitive]);
}
</script>
</body>
</html>Output

Click the “Result” button −

Example
<!DOCTYPE html>
<html>
<body>
<h2>Demo Heading</h2>
<p>Click to display...</p>
<button onclick="display()">Result</button>
<p id="test"></p>
<script>
function display() {
const val = Symbol(2465);
var res = val[Symbol.toPrimitive](99);
console.log(res)
}
</script>
</body>
</html>Output

Click the “Result” button and get the result in Console −
