🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
⚠️ Malware / Trojaner / VirenVorsicht: Android-Malware verschlüsselt Ihre Handys und nimmt heimlich Fotos auf(11.09.2026 um 09:35 Uhr)
🕵️ SicherheitslückenMicrosoft geht endlich eines der nervigsten Probleme von Windows 11 an(11.09.2026 um 11:58 Uhr)
💾 IT Security ToolsSysinternals Suite(11.09.2026 um 12:00 Uhr)
🕵️ SicherheitslückenDefender 0-Day ShieldBreak (CVE-2026-69414) nicht sauber gepatcht - BornCity(11.09.2026 um 12:52 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
⚠️ Malware / Trojaner / VirenVorsicht: Android-Malware verschlüsselt Ihre Handys und nimmt heimlich Fotos auf(11.09.2026 um 09:35 Uhr)
🕵️ SicherheitslückenMicrosoft geht endlich eines der nervigsten Probleme von Windows 11 an(11.09.2026 um 11:58 Uhr)
💾 IT Security ToolsSysinternals Suite(11.09.2026 um 12:00 Uhr)
🕵️ SicherheitslückenDefender 0-Day ShieldBreak (CVE-2026-69414) nicht sauber gepatcht - BornCity(11.09.2026 um 12:52 Uhr)

🔧 Programmierung 🕛 vor 5 Monaten 5 Min Lesezeit
0

Functions in Javascript

↗ Quelle (dev.to)
🗣️ Stimme:

Functions are sets of instructions. These are reusable building blocks which are used to execute a specific task whenever we need it.



Uses of function:





1) Function keyword — function



What it means:

This word tells the computer:

👉 "I am going to create a function."



2) Function name — sum



What it means:

This is the name of the function.

You use this name later to run the function.



3) Parameters — (x, y)



What it means:

These are inputs the function expects to receive.



Simple example:

Like a calculator asking:

👉 "Give me two numbers."



Here:

x = first number

y = second number



4) Function body — { }



What it means:

This is the working area of the function.

All instructions are written inside these curly brackets.



Simple example:

Like a kitchen where cooking happens.



5) Return keyword — return



What it means:

This sends the result back after the work is done.



Simple example:

Like giving the answer after solving a problem.



👉 "Here is your result."



6) Statement — return x + y;

What it means:

This is the actual task the function performs.



Here it means:

👉 Add x and y



Simple example:

If:



x = 4

y = 5



Result:



9



7) Arguments — (4, 5)

What it means:

These are the real values sent to the function.



Simple example:

Parameters are placeholders:



(x, y)



Arguments are actual numbers:



(4, 5)



8) Function call — sum(4, 5)



What it means:

This tells the function to run.



Simple example:

Like calling someone on the phone:

👉 "Sum, please do this calculation."



9) Variable — let result



What it means:

This stores the answer returned by the function.



Simple example:

Like saving the result in a box.



result = 9



Simple Real-Life Example



function like a juice machine:



Programming Term Real-Life Meaning

Function Juice machine

Parameters Fruits

Function body: Machine process

Return Juice output

Arguments Actual fruits given

Function call Pressing the button



Types of function:





Other lists of functions which were noticed while referring to other sites:




  • Generator Function

  • Higher-Order Function

  • Nested Functions

  • Pure Functions

  • Default Parameter Function

  • Rest Parameter Function



Scenario 1:



*Function to find even or odd number *




CODE
<!DOCTYPE html>
<html>
<head>
<title>Odd or Even</title>
</head>

<body>
<script>
// Declare a number
let number = 9;

// Function to check odd or even
function addorEven() {
if (number % 2 == 0) {
return 100; // Even number
}
else {
return 200; // Odd number
}
}

// Call the function
let findoutvalue = addorEven();

// Print the result
console.log(findoutvalue + 20);
</script>
</body>
</html>






Output




CODE
220






Scenario 2:



Function to find the biggest number




CODE
<!DOCTYPE html>
<html>
<head>
<title>Function Demo</title>
</head>

<body>
<script>

// Function to find the biggest number
function bigNumber(a, b, c) {

if (a > b && a > c) {
return "A is biggest";
}

else if (b > a && b > c) {
return "B is biggest";
}

else {
return "C is biggest";
}

}

// Call the function
let numberInput = bigNumber(10, 11, 9);

// Print the result
console.log("The final result of biggest number: " + numberInput);

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






Output




CODE
The final result of biggest numberB is bigger



Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
The Gemini desktop app is now available for Windows
1 Quelle
Windows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC
1 Quelle
Vorsicht: Android-Malware verschlüsselt Ihre Handys und nimmt heimlich Fotos auf
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Functions in Javascript

Thematisch verwandte Begriffe: Functions, Javascript · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...