Sign in to Track Your Progress
Module
Sign in to Track Your Progress
By Mukul Latiyan
Updated on : 14 Oct 2022
7 mins read
Published on : 14 Oct 2022
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Comments in JavaScript</title>
</head>
<body>
<h1>Example</h1>
<h2>Comments in JavaScript</h2>
<script>
let str = 0;
// Using the Boolean method
console.log(Boolean(str));
str = "";
// Using the Boolean method
console.log(Boolean(str));
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Comments in JavaScript</title>
</head>
<body>
<h1>Example</h1>
<h2>Comments in JavaScript</h2>
<script>
let str = 0;
/*
Using Boolean method
in the console.log()
shown below
*/
console.log(Boolean(str));
str = "";
/*
Using the Boolean method
in the console.log()
shown below
*/
console.log(Boolean(str));
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Comments in JavaScript</title>
</head>
<body>
<h1>Example</h1>
<h2>Comments in JavaScript</h2>
<script>
let str = 0;
/*
commenting the console.log()
functions call below
*/
// console.log(Boolean(str));
str = "";
/*
Using Boolean method
in the console.log()
shown below
*/
console.log(Boolean(str));
</script>
</body>
</html>