Function and function in Javascript

Your Ad Here

Function and function in Javascript

All of us know how to write functions in Javascript right ?


function SayHello()
{
alert(”Hello”);
}

Now take a look at the following code:


var SayHello2 = new Function(”alert(’Hello’);”);

Now what happens when I run the following code ?


SayHello();
SayHello2();

Both of them run in the same way.
Lets know what happens here.

Function is a built in type in Javascript. One of its properties contains the executable code and can be invoked by using ().

Function and function in Javascript

Tags:

Leave a Reply


Books 24x7