Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
••••
Sicherheitslücken (CVE)CVE-2026-20786 | Intel NPU Driver out-of-bounds (Nessus ID 335912)(29.09.2026 um 05:01 Uhr)
••••••••••
Sicherheitslücken (CVE)CVE-2026-20786 | Intel NPU Driver out-of-bounds (Nessus ID 335912)(29.09.2026 um 05:01 Uhr)
••••••
Intelligence View
⚡ tsecurity.de Intelligence

JavaScript,Method,Datatype

What is JavaScript ? JavaScript is the world's most popular programming language. JavaScript is the programming language of the Web.JavaScript is easy to learn. Why Study JavaScript? JavaScript is one of the 3 languages all web…

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

What is JavaScript ?



JavaScript is the world's most popular programming language.

JavaScript is the programming language of the Web.JavaScript is easy to learn.



Why Study JavaScript?



JavaScript is one of the 3 languages all web developers must learn:




  1. HTML to define the content of web pages

  2. CSS to specify the layout of web pages

  3. JavaScript to program the behavior of web pages



What is function?



In JavaScript, a function is a block of code designed to perform a particular task. It allows you to reuse code, organize logic, and create modular applications.



1. Declaring a Function




function greet() {
console.log("Hello, world!");
}






2. Calling a Function





greet(); // Output: Hello, world!






3. Function with Parameters




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

console.log(add(5, 3)); // Output: 8







4. Function Expression




const multiply = function(x, y) {
return x * y;
};

console.log(multiply(4, 5)); // Output: 20







5.Why Functions Are Useful



Code reusability



Modular design



Easier debugging



Improved readability



JavaScript has 8 Datatypes



String

Number

Bigint

Boolean

Undefined

Null

Symbol

Object



In JavaScript, let, const, and var are used to declare variables, but they behave differently in terms of scope, hoisting, and mutability.



1. var (Old, avoid using it)



Function-scoped

Can be re-declared and updated

Hoisted (initialized as undefined)





function testVar() {
var x = 10;
if (true) {
var x = 20; // same variable
console.log(x); // 20
}
console.log(x); // 20
}






2. let (Modern, preferred for variables that change)



Block-scoped

Can be updated, but not re-declared in the same scope

Hoisted, but not initialized (accessing before declaration gives error)




function testLet() {
let y = 10;
if (true) {
let y = 20; // different variable
console.log(y); // 20
}
console.log(y); // 10
}






3. const (Modern, for constants)



Block-scoped

Cannot be updated or re-declared

Must be initialized at declaration

For objects/arrays, the reference is constant (you can still change properties)




const z = 30;
// z = 40; ❌ Error: Assignment to constant variable

const person = { name: "Alice" };
person.name = "Bob"; // ✅ Allowed: changing property






In JavaScript, the **return keyword is used inside a function to:**

Stop the function execution.

Send a value back to the place where the function was called.



Basic Syntax




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

let result = add(5, 3); // result = 8
console.log(result); // Output: 8







parameters and arguments



In JavaScript, parameters and arguments are related to how functions receive data. They’re often confused, but they mean different things:



Parameters



These are placeholders in the function definition.

They define what kind of input the function can take.




function greet(name) { // 'name' is a parameter
console.log("Hello, " + name);
}






Arguments



These are the actual values you pass when calling the function.




greet("Alice"); // "Alice" is an argument






Example with Multiple Parameters and Arguments




function add(a, b) { // a and b are parameters
return a + b;
}

let sum = add(5, 3); // 5 and 3 are arguments
console.log(sum); // Output: 8




Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten JavaScript,Method,Datatype

Thematisch verwandte Begriffe: JavaScriptMethodDatatype · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-101093 | Cotonti through 1.0.0 contains a cross-site request forgery vulnerabili…
Advisory →
tsecurity.de Icon
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