08.12.2022 Views

javascript_tutorial

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Boolean

Object

Function

Undefined

Null

"boolean"

"object"

"function"

"undefined"

"object"

Example

The following code shows how to implement typeof operator.

<html>

<body>

<script type="text/javascript">

<!--

var a = 10;

var b = "String";

var linebreak = "<br />";

result = (typeof b == "string" ? "B is String" : "B is Numeric");

document.write("Result => ");

document.write(result);

document.write(linebreak);

result = (typeof a == "string" ? "A is String" : "A is Numeric");

document.write("Result => ");

document.write(result);

document.write(linebreak);

47

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!