SlideShare a Scribd company logo
Function calling in js
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
Function calling using
java script
SWALIH T
swalihk321@gmail.com
www.facebook/ swalih321
twitter.com/swalih321
in.linkedin.com/in/swalih321
9539353663
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.
Example
<html>
<head>
<script type="text/javascript">
<!--
function popup() {
alert("Hello World")
}
//-->
</script>
</head>
<body>
<input type="button" onclick="popup()" value="Enter">
</body>
</html>
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 (,)
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>
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.
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>
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
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: info@baabtra.com

More Related Content

PDF
Print function in PHP
PDF
Automated testing for client-side - Adam Klein, 500 Tech
PPTX
Operators
PDF
2013-06-25 - HTML5 & JavaScript Security
PPTX
Haml in 5 minutes
DOCX
Java script
PDF
Haml. New HTML? (RU)
DOCX
While R&D WITH ORACLE SOA
Print function in PHP
Automated testing for client-side - Adam Klein, 500 Tech
Operators
2013-06-25 - HTML5 & JavaScript Security
Haml in 5 minutes
Java script
Haml. New HTML? (RU)
While R&D WITH ORACLE SOA

What's hot (19)

PPTX
Java script errors &amp; exceptions handling
PDF
My Test Automation Journey
PPTX
Upstate CSCI 450 WebDev Chapter 4
PPTX
Data validation in web applications
PDF
Pengulangan do while
ODP
Mechanize at the Ruby Drink-up of Sophia, November 2011
PPTX
Esd input inplace
PPT
Gems Of Selenium
PPTX
11. move in Symfony 4
PPTX
9. lower in Symfony 4
ODP
Django Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
PDF
BDD with cucumber
PPTX
servlet db connectivity
PPT
Creating A User‑Defined Function In Excel Using Vba
PPTX
Form using html and java script validation
DOCX
Controller in AngularJS
PPTX
Form Validation
PDF
Build a game with javascript (may 21 atlanta)
PDF
Simplifying Code: Monster to Elegant in 5 Steps
Java script errors &amp; exceptions handling
My Test Automation Journey
Upstate CSCI 450 WebDev Chapter 4
Data validation in web applications
Pengulangan do while
Mechanize at the Ruby Drink-up of Sophia, November 2011
Esd input inplace
Gems Of Selenium
11. move in Symfony 4
9. lower in Symfony 4
Django Introduction Osscamp Delhi September 08 09 2007 Mir Nazim
BDD with cucumber
servlet db connectivity
Creating A User‑Defined Function In Excel Using Vba
Form using html and java script validation
Controller in AngularJS
Form Validation
Build a game with javascript (may 21 atlanta)
Simplifying Code: Monster to Elegant in 5 Steps
Ad

Viewers also liked (11)

PDF
Intoduction to php restful web service
PPTX
PPTX
PDF
Сети для самых маленьких. Часть восьмая. BGP и IP SLA
PDF
Linkmeup
Ad

Similar to Function calling in js (20)

PPTX
Java scriptfunction
PPTX
Lecture 4- Javascript Function presentation
PPTX
11_Functions_Introduction.pptx javascript notes
PDF
JavaScript - Chapter 6 - Basic Functions
PPTX
csc ppt 15.pptx
PPTX
Wt unit 5
PDF
Functional Javascript
PPTX
Java script functions
PPTX
Java script
PDF
java script functions, classes
PPT
PPT
JavaScript Introductin to Functions
PPTX
wp-UNIT_III.pptx
PPTX
LinkedIn TBC JavaScript 100: Functions
PPTX
javascript function ujjwal matoliya.pptx
PPTX
Javascripting.pptx
Java scriptfunction
Lecture 4- Javascript Function presentation
11_Functions_Introduction.pptx javascript notes
JavaScript - Chapter 6 - Basic Functions
csc ppt 15.pptx
Wt unit 5
Functional Javascript
Java script functions
Java script
java script functions, classes
JavaScript Introductin to Functions
wp-UNIT_III.pptx
LinkedIn TBC JavaScript 100: Functions
javascript function ujjwal matoliya.pptx
Javascripting.pptx

More from baabtra.com - No. 1 supplier of quality freshers (20)

PPTX
Agile methodology and scrum development
PDF
Acquiring new skills what you should know
PDF
Baabtra.com programming at school
PDF
99LMS for Enterprises - LMS that you will love
PPTX
Chapter 6 database normalisation
PPTX
Chapter 5 transactions and dcl statements
PPTX
Chapter 4 functions, views, indexing
PPTX
PPTX
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
PPTX
Chapter 1 introduction to sql server
PPTX
Chapter 1 introduction to sql server
Agile methodology and scrum development
Acquiring new skills what you should know
Baabtra.com programming at school
99LMS for Enterprises - LMS that you will love
Chapter 6 database normalisation
Chapter 5 transactions and dcl statements
Chapter 4 functions, views, indexing
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 1 introduction to sql server
Chapter 1 introduction to sql server

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Encapsulation theory and applications.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PPT
Teaching material agriculture food technology
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
KodekX | Application Modernization Development
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
cuic standard and advanced reporting.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Machine learning based COVID-19 study performance prediction
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The AUB Centre for AI in Media Proposal.docx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Encapsulation theory and applications.pdf
NewMind AI Monthly Chronicles - July 2025
Teaching material agriculture food technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Understanding_Digital_Forensics_Presentation.pptx
Approach and Philosophy of On baking technology
Per capita expenditure prediction using model stacking based on satellite ima...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
KodekX | Application Modernization Development
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
cuic standard and advanced reporting.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Machine learning based COVID-19 study performance prediction
Reach Out and Touch Someone: Haptics and Empathic Computing

Function calling in js

  • 2. 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
  • 3. Function calling using java script SWALIH T swalihk321@gmail.com www.facebook/ swalih321 twitter.com/swalih321 in.linkedin.com/in/swalih321 9539353663
  • 4. 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.
  • 5. Example <html> <head> <script type="text/javascript"> <!-- function popup() { alert("Hello World") } //--> </script> </head> <body> <input type="button" onclick="popup()" value="Enter"> </body> </html>
  • 6. 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 (,)
  • 7. 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>
  • 8. 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.
  • 9. 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>
  • 10. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 11. 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: info@baabtra.com