JavaScript Functions In Hindi – Functions In JS in Hindi

JavaScript

JavaScript Functions In HindiFunctions In JS in HindiFunction in Hindi in JS ko Ham Isliye Istemal Karte Hai Taki Hame Ek hi Code Ko Bar Bar Likhna Na Pade Isliye JavaScript Language Me functions ko Banate hai |

JavaScript Functions In Hindi

Functions Ko Understand Karne Ke Liye Hamne A to Z Point Ko Cover Kiya Aap Niche Inhe Read Karke Understand Kar Sakte Hain |

What is JS Function In Hindi ?

Function Line of code ya subprogram Hota hai Inka Ek group Hota Hai Chota program ka us program Me Kitni Bhi Code line ho Sakti Hai or Inka Aapna Ek name & Features Hota Hai Or Function ko Aap Program me Kahi Bhi Call Ya Dobara Istemal Kar Sakte Hai |

Why Use JS Function in Hindi ?

Jab Ham koi code Likhte hai to Wo code Main ke under hi execute hota hai | Lekin Jab koi program bahut Bada Ho Jaye Or koi code of line Bar Bar repeat ho rhi ho to ham function Bana Sakte hai isse program aashan ho jata hai |

Types of Function In PHP in Hindi

Function Mainly 2 Tarah ke hote hai |

  1. Built-In Function
  2. User-Defined Function

Built-In Function in Js in Hindi

Javascript Main Waise To Built-in Function 1000+ Ke Upper Hain Jinhe Aap Keval Call Karke Run Kar Sakte Hain.

Aane Wale Chapter Me Built-in Function Ko Ham Understand Karne Wale Hai |

Click Here :-JS Variables

Example Built In Function:

var obj1 = new Boolean()
var obj2 = new Boolean()
var obj3 = new Date()

document.write(String(obj1));
document.write(String(obj2));
document.write(String(obj3));

Output:

false
true
The Jan 08 2020 2:15:08 GMT+0530 (India Standart Time)

User Defined Function in JavaScript in Hindi

User Defined Function Ko Ham function Se Create Karte Hain. Aap Niche Syntax Dekh Sakte Hain |

Syntax:

function name(parameter1, parameter2, parameter3) {
  // code to be executed
}
  • function:- Jab ham User-defined function banate hai to hame Function Keyword ka istemal Karna padta hai |
  • Function Name:- Jab Ham User Defined Function Banate hai To ham function ka name dete hai & uska name ham Kuch bhi de sakte hai |
  • Parameter List ( Arguments ):- Parameter List means Hota hai ki use kitne inputs diye Jayenge suppose agar ham Ek 2 number addition ka program banate hai to ham 2 parameter pass karenge |

Example :

function MyFunction(a,b){
	return a+b;
}

Add Two Number using JS function

funtion MyFunction(a,b){
  return a+b;
}

var add = MyFunction(10,20)   // calling function
document.write(add)

Output:

30

Example 2:

Simple Massage Print Karne Wala Function Banate Hain |

<script>
function myFunction() {
   document.write("hello World");
}

myFunction() 
</script>

Output:

hello World

Example 3 :- Find 2 Max Value Using Function in JS

<button onclick="myFunction(2,3)">Try it</button>

<p id="demo"></p>

<script>
function myFunction(a,b) {

  if (a > b) {
    greeting = "Greater Value Is : 2";
  }
  else {
    greeting = "Greater Value Is : 3";
  }
  document.getElementById("demo").innerHTML = greeting;
}
</script>

Output:

Greater Value Is : 3

JavaScript Function Call in Hindi

  1. Call by Value
  2. Call By Reference

Call By Value :- Call by Value Means Ham Jab function ko call karenge to usko value supply krenge ya fir variable ka name supply karenge means waha par jo value hogi wo actual argument se copy ho kar formal argument me chali jayegi. lekin ye value 2 hogi 1 value jo actual argument ke pass hai or 1 iski value copy jo formal argument ke pass hai|

Call By Reference:- Call By Reference Matlab ye Keval address ko hold Karta hai |

Leave a Reply

Your email address will not be published. Required fields are marked *