Function calling in js
Upcoming SlideShare
Loading in...5

Like this? Share it with your network


Function calling using java script

Function calling using java script



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Function calling in js Presentation Transcript

  • 1. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 2. Function calling using java script SWALIH T www.facebook/ swalih321 9539353663
  • 3. Function • A function is a block of code that will be executed when "someone" calls it: • A function is written as a code block (inside curly { } braces), preceded by the function keyword: • The function can be called directly when an event occurs (like when a user clicks a button), and it can be called from "anywhere" by JavaScript code.
  • 4. Example <html> <head> <script type="text/javascript"> <!-- function popup() { alert("Hello World") } //--> </script> </head> <body> <input type="button" onclick="popup()" value="Enter"> </body> </html>
  • 5. With Arguments • When you call a function, you can pass along some values to it, these values are called arguments or parameters. • These arguments can be used inside the function. You can send as many arguments as you like, separated by commas (,)
  • 6. Example<html> <body> <p>Click the button to call a function with arguments</p> <button onclick="myFunction('Swalih','Mukkam')">Try it</button> <script> function myFunction(name,place) { alert("Welcome " + name + ", are you in " + place); } </script> </body> </html>
  • 7. Functions With a Return Value • Sometimes you want your function to return a value back to where the call was made. • This is possible by using the return statement. • When using the return statement, the function will stop executing, and return the specified value.
  • 8. Example <html> <body> <p>This example calls a function which performs a calculation, and returns the result:</p> <p id="demo"></p> <script> function myFunction(a,b) { return a*b; } document.getElementById("demo").innerHTML=myFunction(4,3); </script> </body> </html>
  • 9. If this presentation helped you, please visit our page and like it. Thanks in advance. | |
  • 10. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: