create your own

javascript typeof

66
rate or flag this page

By motorcyclehelmets


Google Page Rank


javascript typeof

javascript typeof

Here is the code:

<html 
>
<head>
<h2> Use of typeOf Operator </h2>
<script>
var var1 = new String("Hello World");
var var2="Hello World";
var var3=new Date();
var var4=true;
var var5=10;

document.write("<b>The var1 is </b>"+typeof(var1)+"<br>");
document.write("<b>The var2 is </b>"+typeof(var2)+"<br>");
document.write("<b>The var3 is </b>"+typeof(var3)+"<br>");
document.write("<b>The var4 is </b>"+typeof(var4)+"<br>");
document.write("<b>The var5 is </b>"+typeof(var5)+"<br>");
document.write(typeof null+"<br>");
document.write(typeof myVar);
</script>
</head>
<body bgcolor="lightBlue"/>
</html>

Output will be displayed as:

Use of the typeof operator

The Var1-object

The Var2-string

The Var3-object

The Var4-boolean

The Var5-number

Object-undefined

Rev.Sinner- another nerd page

javascript typeof


Comments

RSS for comments on this Hub

No comments yet.

Submit a Comment

Members and Guests

Sign in or sign up and post using a hubpages account.


optional


  • No HTML is allowed in comments, but URLs will be hyperlinked
  • Comments are not for promoting your hubs or other sites

javascript software

working