Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
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.
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