Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
IT Security NachrichtenMehrere Probleme in GLib (Ubuntu)(21.09.2026 um 22:23 Uhr)
IT Security NachrichtenZwei Probleme in gstreamer1-plugins-base (Red Hat)(21.09.2026 um 22:23 Uhr)
IT Security NachrichtenAnthropic-linked CVEs pile up, attackers mostly shrug(22.09.2026 um 00:32 Uhr)
IT Security DownloadsGitHub Release: microsoft/WSL v2.9.13 (22.09.2026)(22.09.2026 um 00:16 Uhr)
IT NachrichtenBattery Size Upgrades Inbound for Galaxy S27 Ultra and Pro(21.09.2026 um 23:50 Uhr)
IT NachrichtenGoogle Play Services Update Brings Motion Assist(22.09.2026 um 00:29 Uhr)
IT Security NachrichtenMehrere Probleme in GLib (Ubuntu)(21.09.2026 um 22:23 Uhr)
IT Security NachrichtenZwei Probleme in gstreamer1-plugins-base (Red Hat)(21.09.2026 um 22:23 Uhr)
IT Security NachrichtenAnthropic-linked CVEs pile up, attackers mostly shrug(22.09.2026 um 00:32 Uhr)
IT Security DownloadsGitHub Release: microsoft/WSL v2.9.13 (22.09.2026)(22.09.2026 um 00:16 Uhr)
IT NachrichtenBattery Size Upgrades Inbound for Galaxy S27 Ultra and Pro(21.09.2026 um 23:50 Uhr)
IT NachrichtenGoogle Play Services Update Brings Motion Assist(22.09.2026 um 00:29 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Important Terminologies in JavaScript

1. Function Statement A function statement is a simple way of creating a function: function a() { console.log("a called"); } This simple way of creating a function is known as a function statement. 2. Function…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!




1. Function Statement



A function statement is a simple way of creating a function:




function a() {
console.log("a called");
}






This simple way of creating a function is known as a function statement.






2. Function Expression



A function expression is when a function acts like a value of a variable:




var b = function() {
console.log("b called");
};









3. Difference Between Function Statement and Function Expression



The major difference between these two is hoisting:




a(); // Output: "a called"
b(); // Output: TypeError

function a() {
console.log("a called");
}

var b = function() {
console.log("b called");
};






In this code, during the hoisting phase (the memory allocation phase), a is assigned its function definition. But in the case of a function expression, b is treated like any other variable and is assigned undefined initially. Until the code hits b = function(), b remains undefined. Therefore, calling b() before its definition results in an error. This is the major difference between a function statement and a function expression.






4. Function Declaration



A function declaration is nothing but a function statement. Function declaration and function statement are the same things:




function a() {
console.log("a called");
}









5. Anonymous Function



An anonymous function is a function without a name:




function() {
// Code
}






Anonymous functions do not have their own identity. Creating an anonymous function like this will give you a syntax error:




function() {
// Code
}






Because an anonymous function looks like a function statement but has no name, according to the ECMAScript specification, functions should always have a name. Therefore, function () {} is invalid syntax. Anonymous functions are used where functions are used as values:




var b = function() {
console.log("b called");
};









6. Named Function Expression



A named function expression is like a function expression but with a name:




var b = function xyz() {
console.log("b called");
};






If you call b(), it works, but calling xyz() will give an error. xyz is not defined in the outer scope; it is only available inside the function itself:




var b = function xyz() {
console.log(xyz);
};

b(); // Prints the function definition
xyz(); // ReferenceError: xyz is not defined









7. Difference Between Parameters and Arguments



Parameters are the names listed in the function definition, while arguments are the values passed to the function when it is invoked:




function a(param1, param2) {
console.log("hello");
}

a(1, 2); // 1 and 2 are the arguments









8. First-Class Functions



The ability to use functions as values is known as first-class functions. This means functions can be passed as arguments to other functions and can be returned from functions:




var b = function(x) {
console.log(x);
};

b(function() {
console.log("Anonymous function");
});

function xyz() {
console.log("Named function");
}

b(xyz);

var c = function() {
return function() {
console.log("Returned anonymous function");
};
};

console.log(c()());






First-class functions can be used like values and are also called first-class citizens.






9. Callback Functions



Callback functions are first-class citizens in JavaScript. This means you can take a function and pass it into another function, and when you do so, the function you pass into another function is known as a callback function. Callback functions are very powerful in JavaScript. They give us access to the asynchronous world in a synchronous single-threaded language. Due to callbacks, we can do asynchronous things in JavaScript:




function x(callback) {
console.log("x");
callback();
}

x(function y() {
console.log("y");
});






If you call a function and pass a function into another function, the passed function is the callback function. This function is known as a callback function because it is called back later in the code. You give the responsibility of this function to another function. For example:




setTimeout(function() {
console.log("timer");
}, 5000);

function x(y) {
console.log("x");
y();
}

x(function y() {
console.log("y");
});






JavaScript has just one call stack, also known as the main thread. Everything executed inside your page is executed through the call stack only. If any operation blocks the call stack, it is known as blocking the main thread. For example, if your function x() had a very heavy operation that takes around 20 to 30 seconds to complete, by that time, because JavaScript has only one call stack, it won't be able to execute any other function inside the code. That means everything will be blocked on the code. This is why we should never block our main thread. We should always try to use asynchronous operations for tasks that take time, just like using setTimeout:




setTimeout(function() {
console.log("timer");
}, 5000);

function x(y) {
console.log("x");
y();
}

x(function y() {
console.log("y");
});






Using web APIs, setTimeout, and callback functions, we can achieve asynchronous operations in JavaScript..



We know how to use these concepts practically, but we often don't know the terminologies. If an interviewer asks what a function expression is, we might get stuck because we don't know the term. A function expression is when a function acts like a value of a variable:




var b = function() {
console.log("b called");
};






However, we use this type of syntax many times in JavaScript coding without knowing what it's called.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Important Terminologies in JavaScript

Thematisch verwandte Begriffe: Important, Terminologies, 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 ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-49449 | Joplin is an open source note-taking and to-do application that organise…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick