Simple way to learn JavaScript function. #3

 

Important Functions of JavaScript.

1. alert()

2. confirm()

3. console.log()

4. document.write()

5. prompt()

What is  alert() and how to use ?

alert() : It is used to alert the user that something has happened.

Example Code : 

<script type = "text/javascript">

alert("Welcome To Trisera Ti");                

</script>

Output :



What is confirm() and how to use ?

confirm() : Opens up a Confirm/Cancel dialog and returns true/false depending on user's                             click.

Example Code:

<script type="text/javascript">

confirm("Login to Trisera Ti")

</script>

Output :




What is console.log() and how to use ?


console.log() : Writes information to the browser console , good for debugging purposes.

Example Code : 

<script type = "text/javascript" >
 
console.log (" Learn easy javascript with trisera ");

</script>

Output :



What is document.write() and how to use ?

document.write() : Write directly to the HTML document .

Example Code :

<script type = "text/javascript" >

 document.write("Trisera Ti"):

</script>

Output :

  " write text on the page "

What is prompt() and how to use ?

prompt(msg, default) : Create an dialog for user input.

Example Code : 

<script type = ''text/javascript" >

    prompt("hello","triserati");

</script>
 
Output :



Post a Comment

Previous Post Next Post