SlideShare a Scribd company logo
1 of 11
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

What's hot

Form using html and java script validation
Form using html and java script validationForm using html and java script validation
Form using html and java script validation
Maitree Patel
 
Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)
Thinkful
 

What's hot (19)

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

Viewers also liked (11)

Stored procedure
Stored procedureStored procedure
Stored procedure
 
.Net framework
.Net framework.Net framework
.Net framework
 
Intoduction to php restful web service
Intoduction to php  restful web serviceIntoduction to php  restful web service
Intoduction to php restful web service
 
Normalization
NormalizationNormalization
Normalization
 
Header creation in CPP
Header creation in CPPHeader creation in CPP
Header creation in CPP
 
Memory
MemoryMemory
Memory
 
function Creation in Mysql
function Creation in Mysqlfunction Creation in Mysql
function Creation in Mysql
 
Database connectivity in ci
Database connectivity in ciDatabase connectivity in ci
Database connectivity in ci
 
ASP.NET Basics
ASP.NET Basics ASP.NET Basics
ASP.NET Basics
 
Сети для самых маленьких. Часть восьмая. BGP и IP SLA
Сети для самых маленьких. Часть восьмая. BGP и IP SLAСети для самых маленьких. Часть восьмая. BGP и IP SLA
Сети для самых маленьких. Часть восьмая. BGP и IP SLA
 
Linkmeup
LinkmeupLinkmeup
Linkmeup
 

Similar to Function calling in js

JAVASCRIPT 1.pptx.pptx
JAVASCRIPT 1.pptx.pptxJAVASCRIPT 1.pptx.pptx
JAVASCRIPT 1.pptx.pptx
BeingPrime
 
Java script frame history
Java script frame historyJava script frame history
Java script frame history
H K
 

Similar to Function calling in js (20)

Wt unit 5
Wt unit 5Wt unit 5
Wt unit 5
 
Java script functions
Java script   functionsJava script   functions
Java script functions
 
Java Script
Java ScriptJava Script
Java Script
 
Nagios Conference 2014 - Troy Lea - JavaScript and jQuery - Nagios XI Tips, T...
Nagios Conference 2014 - Troy Lea - JavaScript and jQuery - Nagios XI Tips, T...Nagios Conference 2014 - Troy Lea - JavaScript and jQuery - Nagios XI Tips, T...
Nagios Conference 2014 - Troy Lea - JavaScript and jQuery - Nagios XI Tips, T...
 
Practica n° 7
Practica n° 7Practica n° 7
Practica n° 7
 
Java scriptfunction
Java scriptfunctionJava scriptfunction
Java scriptfunction
 
JAVASCRIPT 1.pptx.pptx
JAVASCRIPT 1.pptx.pptxJAVASCRIPT 1.pptx.pptx
JAVASCRIPT 1.pptx.pptx
 
Java script programms
Java script programmsJava script programms
Java script programms
 
Javascript basics for automation testing
Javascript  basics for automation testingJavascript  basics for automation testing
Javascript basics for automation testing
 
Functions in javascript
Functions in javascriptFunctions in javascript
Functions in javascript
 
JavaScript Operators
JavaScript OperatorsJavaScript Operators
JavaScript Operators
 
JavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptxJavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptx
 
Basics of Java Script (JS)
Basics of Java Script (JS)Basics of Java Script (JS)
Basics of Java Script (JS)
 
How to perform debounce in react
How to perform debounce in reactHow to perform debounce in react
How to perform debounce in react
 
Java script frame history
Java script frame historyJava script frame history
Java script frame history
 
jQuery
jQueryjQuery
jQuery
 
Web Application in java.pptx
Web Application in java.pptxWeb Application in java.pptx
Web Application in java.pptx
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
Backbone - TDC 2011 Floripa
Backbone - TDC 2011 FloripaBackbone - TDC 2011 Floripa
Backbone - TDC 2011 Floripa
 
8486477.ppt
8486477.ppt8486477.ppt
8486477.ppt
 

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

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

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

Function calling in js

  • 1.
  • 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