Home
<!DOCTYPE html> <html> <body> <h1>Demo: typeof operator</h1> <script> var str = "this is str"; var num = 100; if (typeof str === "string"){ alert("str is a string type"); } if (typeof num === "number"){ alert("num is a number type"); } </script> </body> </html>
Result: