Skip to content
Menu
  • Company
    • About Us
    • Store
    • Contact Us
  • E – Seva Kendra Common Service Center
  • Products And Services
  • Join our Social Network
  • Search
  • Company
    • About Us
    • Store
    • Contact Us
  • E – Seva Kendra Common Service Center
  • Products And Services
  • Join our Social Network

Instarr Softwares Ichalkaranji

Good sales people are first to be hired and last to be fired - Mr Shiv Khera

JavaScript Function

JavaScript Function:-

JavaScript provides functions similar to most of the scripting and programming languages.

In JavaScript, a function allows you to define a block of code, give it a name and then execute it as many times as you want.

A JavaScript function can be defined using function keyword.

Syntax:
//defining a function
function <function-name>()
{
// code to be executed
};

//calling a function
<function-name>();

Example:-

<!DOCTYPE html>
<html>
<body>
<h1>Demo: JavaScript function</h1>

<script>
function ShowMessage() {
alert(“Hello World!”);
}

ShowMessage();
</script>
</body>
</html>

Output:-

Hello World

Function Parameters:-

A function can have one or more parameters, which will be supplied by the calling code and can be used inside a function. JavaScript is a dynamic type scripting language, so a function parameter can have value of any data type.

Example:-

<!DOCTYPE html>
<html>
<body>
<h1>Demo: JavaScript function parameters</h1>

<script>
function ShowMessage(firstName, lastName) {
alert(“Hello ” + firstName + ” ” + lastName);
}

ShowMessage(“Steve”, “Jobs”);
ShowMessage(“Bill”, “Gates”);
ShowMessage(100, 200);

</script>
</body>
</html>

Output:-

Hello Steave jobs

Hello Bill Gates

Hello 100 200

 

  • Web Development Course HTML | CSS | Javascript
  • Mysql Database Course
  • PHPmyadmin Course
  • PHP Coding Course
  • Image OCR to Text
  • Solutions to Problems
  • New Instarr Email yourname.instarr@gmail.com
  • Sign Up to Trello for your daily work assignments
  • Keep Open Whatsapp in PC
  • Install XAMPP to Linux
  • Create Gmail Email Templates for Marketing
  • PDF Tools
  • Files Shared instarrcom@gmail.com
  • Learning Center

Copyright © 2025 Instarr Softwares Ichalkaranji. All Rights Reserved.

Codilight Theme by FameThemes